Skip to content

Commit f88e9fc

Browse files
Baochen Qiangjeff-t-johnson
authored andcommitted
wifi: ath12k: fix dead lock while flushing management frames
Commit [1] converted the management transmission work item into a wiphy work. Since a wiphy work can only run under wiphy lock protection, a race condition happens in below scenario: 1. a management frame is queued for transmission. 2. ath12k_mac_op_flush() gets called to flush pending frames associated with the hardware (i.e, vif being NULL). Then in ath12k_mac_flush() the process waits for the transmission done. 3. Since wiphy lock has been taken by the flush process, the transmission work item has no chance to run, hence the dead lock. >From user view, this dead lock results in below issue: wlp8s0: authenticate with xxxxxx (local address=xxxxxx) wlp8s0: send auth to xxxxxx (try 1/3) wlp8s0: authenticate with xxxxxx (local address=xxxxxx) wlp8s0: send auth to xxxxxx (try 1/3) wlp8s0: authenticated wlp8s0: associate with xxxxxx (try 1/3) wlp8s0: aborting association with xxxxxx by local choice (Reason: 3=DEAUTH_LEAVING) ath12k_pci 0000:08:00.0: failed to flush mgmt transmit queue, mgmt pkts pending 1 The dead lock can be avoided by invoking wiphy_work_flush() to proactively run the queued work item. Note actually it is already present in ath12k_mac_op_flush(), however it does not protect the case where vif being NULL. Hence move it ahead to cover this case as well. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3 Fixes: 56dcbf0 ("wifi: ath12k: convert struct ath12k::wmi_mgmt_tx_work to struct wiphy_work") # [1] Reported-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220959 Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Link: https://patch.msgid.link/20260113-ath12k-fix-dead-lock-while-flushing-v1-1-9713621f3a0f@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
1 parent 8b8d6ee commit f88e9fc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • drivers/net/wireless/ath/ath12k

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12143,16 +12143,16 @@ static void ath12k_mac_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *v
1214312143
if (drop)
1214412144
return;
1214512145

12146+
for_each_ar(ah, ar, i)
12147+
wiphy_work_flush(hw->wiphy, &ar->wmi_mgmt_tx_work);
12148+
1214612149
/* vif can be NULL when flush() is considered for hw */
1214712150
if (!vif) {
1214812151
for_each_ar(ah, ar, i)
1214912152
ath12k_mac_flush(ar);
1215012153
return;
1215112154
}
1215212155

12153-
for_each_ar(ah, ar, i)
12154-
wiphy_work_flush(hw->wiphy, &ar->wmi_mgmt_tx_work);
12155-
1215612156
ahvif = ath12k_vif_to_ahvif(vif);
1215712157
links = ahvif->links_map;
1215812158
for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {

0 commit comments

Comments
 (0)