-
Notifications
You must be signed in to change notification settings - Fork 103
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask() #1327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
Conversation
stable inclusion from stable-v6.12.42 category: bugfix CVE: CVE-2025-39732 [ Upstream commit 65c12b1 ] 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: d5c6515 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Baochen Qiang <[email protected]> Link: https://patch.msgid.link/20250603-ath11k-use-non-atomic-iterator-v1-1-d75762068d56@quicinc.com Signed-off-by: Jeff Johnson <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 9c0e3144924c7db701575a73af341d33184afeaf) Signed-off-by: Wentao Guan <[email protected]> Conflicts: drivers/net/wireless/ath/ath11k/mac.c
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReplaces atomic station iteration with mutex-based iteration in ath11k_mac_op_set_bitrate_mask() to avoid sleeping-in-atomic-context warnings while disabling peer fixed-rate settings, aligning the iterator type with the potentially sleeping callback. Sequence diagram for bitrate mask update using mutex-based station iterationsequenceDiagram
participant Caller as caller_context
participant HW as ieee80211_hw
participant MAC as ath11k_mac_op_set_bitrate_mask
participant IterMtx as ieee80211_iterate_stations_mtx
participant Station as ieee80211_sta
participant DisableRate as ath11k_mac_disable_peer_fixed_rate
participant WMI as ath11k_wmi
Caller->>MAC: ath11k_mac_op_set_bitrate_mask(hw, vif, mask)
MAC->>HW: access ar and arvif from hw/vif
alt bitrate_mask_requires_disable
MAC->>IterMtx: ieee80211_iterate_stations_mtx(hw, DisableRate, arvif)
loop for each station matching vif
IterMtx->>Station: select station
IterMtx->>DisableRate: callback(ar, arvif, Station)
DisableRate->>WMI: ath11k_wmi_set_peer_param(peer, fixed_rate_none)
WMI-->>DisableRate: completion (may sleep)
end
else bitrate_mask_requires_update_with_lock
MAC->>MAC: mutex_lock(ar->conf_mutex)
MAC->>IterMtx: ieee80211_iterate_stations_mtx(hw, DisableRate, arvif)
loop for each station matching vif
IterMtx->>Station: select station
IterMtx->>DisableRate: callback(ar, arvif, Station)
DisableRate->>WMI: ath11k_wmi_set_peer_param(peer, fixed_rate_none)
WMI-->>DisableRate: completion (may sleep)
end
MAC->>MAC: update arvif->bitrate_mask
MAC->>HW: ieee80211_iterate_stations_atomic(hw, update_new_fixed_rate, arvif)
MAC->>MAC: mutex_unlock(ar->conf_mutex)
end
MAC-->>Caller: return status
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
deepin pr auto review我来对这个代码修改进行审查:
改进建议:
总体来说,这个修改是合理的,提高了代码的安全性和可靠性,虽然可能会有轻微的性能影响,但这种影响是值得的,因为它避免了潜在的并发问题。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request addresses CVE-2025-39732 by fixing a sleeping-in-atomic bug in the ath11k wireless driver. The issue occurs because ath11k_mac_disable_peer_fixed_rate() can sleep (it calls ath11k_wmi_set_peer_param() which may block), but was being passed to ieee80211_iterate_stations_atomic() which requires atomic context. The fix replaces the atomic station iterator with ieee80211_iterate_stations_mtx(), which allows sleeping operations.
Key Changes:
- Replaced two calls to
ieee80211_iterate_stations_atomic()withieee80211_iterate_stations_mtx()when iterating withath11k_mac_disable_peer_fixed_rate() - This allows the iterator function to safely call sleeping WMI commands
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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); |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent mutex handling: ieee80211_iterate_stations_mtx() is called with ar->conf_mutex held here (line 8287), but without it at line 8217-8219. The function ieee80211_iterate_stations_mtx() handles its own internal locking and should be called without holding ar->conf_mutex. Consider moving this call before the mutex_lock() at line 8287 to match the pattern at line 8217 and align with the ath12k driver implementation (see drivers/net/wireless/ath/ath12k/mac.c:6725-6729).
stable inclusion
from stable-v6.12.42
category: bugfix
CVE: CVE-2025-39732
[ Upstream commit 65c12b1 ]
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:
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: d5c6515 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Baochen Qiang [email protected]
Link: https://patch.msgid.link/20250603-ath11k-use-non-atomic-iterator-v1-1-d75762068d56@quicinc.com
Signed-off-by: Jeff Johnson [email protected]
Signed-off-by: Sasha Levin [email protected]
(cherry picked from commit 9c0e3144924c7db701575a73af341d33184afeaf)
Signed-off-by: Wentao Guan [email protected]
Conflicts:
drivers/net/wireless/ath/ath11k/mac.c
Summary by Sourcery
Bug Fixes: