Skip to content

Commit c202e2e

Browse files
Dan CarpenterKalle Valo
authored andcommitted
ath11k: fix a locking bug in ath11k_mac_op_start()
This error path leads to a Smatch warning: drivers/net/wireless/ath/ath11k/mac.c:4269 ath11k_mac_op_start() error: double unlocked '&ar->conf_mutex' (orig line 4251) We're not holding the lock when we do the "goto err;" so it leads to a double unlock. The fix is to hold the lock for a little longer. Fixes: c83c500 ("ath11k: enable idle power save mode") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> [kvalo@codeaurora.org: move also rcu_assign_pointer() call] Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/YBk4GoeE+yc0wlJH@mwanda
1 parent 7064e21 commit c202e2e

File tree

1 file changed

+6
-5
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,11 +4248,6 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
42484248
/* Configure the hash seed for hash based reo dest ring selection */
42494249
ath11k_wmi_pdev_lro_cfg(ar, ar->pdev->pdev_id);
42504250

4251-
mutex_unlock(&ar->conf_mutex);
4252-
4253-
rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx],
4254-
&ab->pdevs[ar->pdev_idx]);
4255-
42564251
/* allow device to enter IMPS */
42574252
if (ab->hw_params.idle_ps) {
42584253
ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_IDLE_PS_CONFIG,
@@ -4262,6 +4257,12 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
42624257
goto err;
42634258
}
42644259
}
4260+
4261+
mutex_unlock(&ar->conf_mutex);
4262+
4263+
rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx],
4264+
&ab->pdevs[ar->pdev_idx]);
4265+
42654266
return 0;
42664267

42674268
err:

0 commit comments

Comments
 (0)