From: Changyul Lee <lcy8047@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
Jiale Yao <yaojiale02@163.com>, John Crispin <john@phrozen.org>,
Sven Eckelmann <sven@narfation.org>,
linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org, Changyul Lee <lcy8047@gmail.com>,
Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Subject: [PATCH ath-next] wifi: ath11k: hold txmgmt_idr_lock while freeing pending mgmt frames
Date: Thu, 12 Nov 2026 23:38:13 -0500 [thread overview]
Message-ID: <20261113043813.2174717-1-lcy8047@gmail.com> (raw)
ath11k_mac_vif_txmgmt_cleanup() and ath11k_mac_tx_mgmt_pending_free()
walk ar->txmgmt_idr without txmgmt_idr_lock. A WMI management TX
completion can meanwhile remove an entry and pass its skb to mac80211,
which frees it. ath11k_mac_vif_txmgmt_cleanup() then reads skb_cb->vif
from the freed skb, and both walks can read an IDR node that was freed
after an RCU grace period.
Hold txmgmt_idr_lock over both walks and make ath11k_mac_tx_mgmt_free()
expect it to be held.
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Suggested-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
---
Found with a static analysis tool we are developing.
This is the follow-up for the skb use-after-free that was left out of
the "wifi: ath: avoid IDR mutation while iterating" series.
Compile-tested only, with x86_64_defconfig plus ATH11K_PCI and W=1.
drivers/net/wireless/ath/ath11k/mac.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1a237adaa37d..ef60811fcf54 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -6151,10 +6151,9 @@ static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id)
struct sk_buff *msdu;
struct ieee80211_tx_info *info;
- spin_lock_bh(&ar->txmgmt_idr_lock);
- msdu = idr_remove(&ar->txmgmt_idr, buf_id);
- spin_unlock_bh(&ar->txmgmt_idr_lock);
+ lockdep_assert_held(&ar->txmgmt_idr_lock);
+ msdu = idr_remove(&ar->txmgmt_idr, buf_id);
if (!msdu)
return;
@@ -6172,8 +6171,10 @@ void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar)
struct sk_buff *msdu;
int buf_id;
+ spin_lock_bh(&ar->txmgmt_idr_lock);
idr_for_each_entry(&ar->txmgmt_idr, msdu, buf_id)
ath11k_mac_tx_mgmt_free(ar, buf_id);
+ spin_unlock_bh(&ar->txmgmt_idr_lock);
}
static void ath11k_mac_vif_txmgmt_cleanup(struct ath11k *ar,
@@ -6183,11 +6184,13 @@ static void ath11k_mac_vif_txmgmt_cleanup(struct ath11k *ar,
struct sk_buff *skb;
int buf_id;
+ spin_lock_bh(&ar->txmgmt_idr_lock);
idr_for_each_entry(&ar->txmgmt_idr, skb, buf_id) {
skb_cb = ATH11K_SKB_CB(skb);
if (skb_cb->vif == vif)
ath11k_mac_tx_mgmt_free(ar, buf_id);
}
+ spin_unlock_bh(&ar->txmgmt_idr_lock);
}
static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif,
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.43.0
reply other threads:[~2026-11-13 4:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113043813.2174717-1-lcy8047@gmail.com \
--to=lcy8047@gmail.com \
--cc=ath11k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=john@phrozen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rameshkumar.sundaram@oss.qualcomm.com \
--cc=sven@narfation.org \
--cc=yaojiale02@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®