Skip to content

Commit 57100b8

Browse files
Aditya Kumar Singhgregkh
authored andcommitted
wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
[ Upstream commit 5a10971 ] In ath12k_mac_assign_vif_to_vdev(), if arvif is created on a different radio, it gets deleted from that radio through a call to ath12k_mac_unassign_link_vif(). This action frees the arvif pointer. Subsequently, there is a check involving arvif, which will result in a read-after-free scenario. Fix this by moving this check after arvif is again assigned via call to ath12k_mac_assign_link_vif(). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Closes: https://scan5.scan.coverity.com/#/project-view/63541/10063?selectedIssue=1636423 Fixes: b5068bc ("wifi: ath12k: Cache vdev configs before vdev create") Signed-off-by: Aditya Kumar Singh <[email protected]> Acked-by: Jeff Johnson <[email protected]> Acked-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> Signed-off-by: Amelia Crate <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 68ec78b commit 57100b8

File tree

1 file changed

+3
-3
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6733,15 +6733,15 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
67336733

67346734
mutex_lock(&ar->conf_mutex);
67356735

6736-
if (arvif->is_created)
6737-
goto flush;
6738-
67396736
if (vif->type == NL80211_IFTYPE_AP &&
67406737
ar->num_peers > (ar->max_num_peers - 1)) {
67416738
ath12k_warn(ab, "failed to create vdev due to insufficient peer entry resource in firmware\n");
67426739
goto unlock;
67436740
}
67446741

6742+
if (arvif->is_created)
6743+
goto flush;
6744+
67456745
if (ar->num_created_vdevs > (TARGET_NUM_VDEVS - 1)) {
67466746
ath12k_warn(ab, "failed to create vdev, reached max vdev limit %d\n",
67476747
TARGET_NUM_VDEVS);

0 commit comments

Comments
 (0)