[PATCH wireless-next 2/2] wifi: mac80211: fix RCU usage in peer probing

Johannes Berg <[email protected]> Sun, 2 Aug 2026 10:40:10 +0200
Newsgroups org.kernel.vger.linux-wireless
Message-ID <20260802104010.6c09477032c4.If024b480b96bf9fe7baa821ed48b80be322d1e44@changeid>
From: Johannes Berg <[email protected]>

Converting the station and chanctx lookups to wiphy_dereference()
was correct for the function itself but removed the rcu_read_lock()
for the later transmit, which requires it, as well. Fix that.

Found with the ap_open_poll_sta hwsim test, which reports

  net/mac80211/tx.c:608 suspicious rcu_dereference_check() usage!

(and four more like it).

Fixes: 1c3f880ed00e ("wifi: mac80211: implement STA-mode peer probing")
Signed-off-by: Johannes Berg <[email protected]>
---
 net/mac80211/cfg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d42f8df9badc..23ae81b88669 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -5035,7 +5035,9 @@ static int ieee80211_probe_peer(struct wiphy *wiphy, struct net_device *dev,
 	}
 
 	local_bh_disable();
+	rcu_read_lock();
 	ieee80211_xmit(sdata, sta, skb);
+	rcu_read_unlock();
 	local_bh_enable();
 
 	return 0;
-- 
2.55.0