Skip to content

Commit c972636

Browse files
WeiZhang-stonejeff-t-johnson
authored andcommitted
wifi: ath12k: fix inconsistent arvif state in vdev_create error paths
ath12k_mac_vdev_create() has three error path issues that leave arvif in an inconsistent state: 1. When ath12k_wmi_vdev_create() fails, the function returns directly without clearing arvif->ar, which was already set before the WMI call. Subsequent code checking arvif->ar to determine vdev readiness will see a non-NULL value despite no vdev existing in firmware. 2. When ath12k_wmi_send_peer_delete_cmd() fails in err_peer_del, the code jumped to err: skipping the DP peer cleanup and vdev rollback, leaving num_created_vdevs, vdev maps and arvif list membership live. 3. When ath12k_wait_for_peer_delete_done() fails, the code jumped to err_vdev_del: skipping the DP peer cleanup. Fix by changing the ath12k_wmi_vdev_create() failure to goto err instead of returning directly, routing both err_peer_del failure paths through err_dp_peer_del: for proper DP peer and vdev rollback, and consolidating the arvif state cleanup at err:. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3 Fixes: 477cabf ("wifi: ath12k: modify link arvif creation and removal for MLO") Signed-off-by: Wei Zhang <wei.zhang@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com> Link: https://patch.msgid.link/20260512044906.1735821-2-wei.zhang@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
1 parent 51d5105 commit c972636

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • drivers/net/wireless/ath/ath12k

drivers/net/wireless/ath/ath12k/mac.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10302,7 +10302,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
1030210302
if (ret) {
1030310303
ath12k_warn(ab, "failed to create WMI vdev %d: %d\n",
1030410304
arvif->vdev_id, ret);
10305-
return ret;
10305+
goto err;
1030610306
}
1030710307

1030810308
ar->num_created_vdevs++;
@@ -10449,13 +10449,13 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
1044910449
if (ret) {
1045010450
ath12k_warn(ar->ab, "failed to delete peer vdev_id %d addr %pM\n",
1045110451
arvif->vdev_id, arvif->bssid);
10452-
goto err;
10452+
goto err_dp_peer_del;
1045310453
}
1045410454

1045510455
ret = ath12k_wait_for_peer_delete_done(ar, arvif->vdev_id,
1045610456
arvif->bssid);
1045710457
if (ret)
10458-
goto err_vdev_del;
10458+
goto err_dp_peer_del;
1045910459

1046010460
ar->num_peers--;
1046110461
}
@@ -10472,8 +10472,6 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
1047210472

1047310473
ath12k_wmi_vdev_delete(ar, arvif->vdev_id);
1047410474
ar->num_created_vdevs--;
10475-
arvif->is_created = false;
10476-
arvif->ar = NULL;
1047710475
ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id);
1047810476
ab->free_vdev_map |= 1LL << arvif->vdev_id;
1047910477
ab->free_vdev_stats_id_map &= ~(1LL << arvif->vdev_stats_id);
@@ -10482,6 +10480,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
1048210480
spin_unlock_bh(&ar->data_lock);
1048310481

1048410482
err:
10483+
arvif->is_created = false;
1048510484
arvif->ar = NULL;
1048610485
return ret;
1048710486
}

0 commit comments

Comments
 (0)