[PATCH ath-next] wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()

Baochen Qiang posted 1 patch 8 months, 1 week ago
drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH ath-next] wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()
Posted by Baochen Qiang 8 months, 1 week ago
ath11k_mac_disable_peer_fixed_rate() is passed as the iterator to
ieee80211_iterate_stations_atomic(). Note in this case the iterator is
required to be atomic, however ath11k_mac_disable_peer_fixed_rate() does
not follow it as it might sleep. Consequently below warning is seen:

BUG: sleeping function called from invalid context at wmi.c:304
Call Trace:
 <TASK>
 dump_stack_lvl
 __might_resched.cold
 ath11k_wmi_cmd_send
 ath11k_wmi_set_peer_param
 ath11k_mac_disable_peer_fixed_rate
 ieee80211_iterate_stations_atomic
 ath11k_mac_op_set_bitrate_mask.cold

Change to ieee80211_iterate_stations_mtx() to fix this issue.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 08d7b136851fabb0a1c1032abcf9c01550e9f4f5..068805daf5fa4e0894be4ea4e8f2e9f756cfdcd3 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8740,9 +8740,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
 				    arvif->vdev_id, ret);
 			return ret;
 		}
-		ieee80211_iterate_stations_atomic(ar->hw,
-						  ath11k_mac_disable_peer_fixed_rate,
-						  arvif);
+		ieee80211_iterate_stations_mtx(ar->hw,
+					       ath11k_mac_disable_peer_fixed_rate,
+					       arvif);
 	} else if (ath11k_mac_bitrate_mask_get_single_nss(ar, arvif, band, mask,
 							  &single_nss)) {
 		rate = WMI_FIXED_RATE_NONE;
@@ -8809,9 +8809,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
 		}
 
 		mutex_lock(&ar->conf_mutex);
-		ieee80211_iterate_stations_atomic(ar->hw,
-						  ath11k_mac_disable_peer_fixed_rate,
-						  arvif);
+		ieee80211_iterate_stations_mtx(ar->hw,
+					       ath11k_mac_disable_peer_fixed_rate,
+					       arvif);
 
 		arvif->bitrate_mask = *mask;
 		ieee80211_iterate_stations_atomic(ar->hw,

---
base-commit: 3d933084a072fd5fb5da54c06a017abc0412c86f
change-id: 20250530-ath11k-use-non-atomic-iterator-b89709d5cf48

Best regards,
-- 
Baochen Qiang <quic_bqiang@quicinc.com>
Re: [PATCH ath-next] wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()
Posted by Jeff Johnson 6 months, 4 weeks ago
On Tue, 03 Jun 2025 10:25:28 +0800, Baochen Qiang wrote:
> ath11k_mac_disable_peer_fixed_rate() is passed as the iterator to
> ieee80211_iterate_stations_atomic(). Note in this case the iterator is
> required to be atomic, however ath11k_mac_disable_peer_fixed_rate() does
> not follow it as it might sleep. Consequently below warning is seen:
> 
> BUG: sleeping function called from invalid context at wmi.c:304
> Call Trace:
>  <TASK>
>  dump_stack_lvl
>  __might_resched.cold
>  ath11k_wmi_cmd_send
>  ath11k_wmi_set_peer_param
>  ath11k_mac_disable_peer_fixed_rate
>  ieee80211_iterate_stations_atomic
>  ath11k_mac_op_set_bitrate_mask.cold
> 
> [...]

Applied, thanks!

[1/1] wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()
      commit: 65c12b104cb942d588a1a093acc4537fb3d3b129

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>