wifi: mac80211: fix WARN_ON_ONCE in ieee80211_tdls_oper
PATCH 1/1 wifi: mac80211: fix WARN_ON_ONCE in ieee80211_tdls_oper
NL80211_TDLS_ENABLE_LINK can be called without completing the TDLS setup handshake, or after the TDLS_PEER_SETUP_TIMEOUT (15 seconds) has expired and tdls_peer_del_work has zeroed out the peer address. In both cases the WARN_ON_ONCE triggers because tdls_peer is either zero or mismatched with the requested peer.
Replace the WARN_ON_ONCE with a proper check that returns -ENOLINK to enforce that ENABLE_LINK can only proceed after a successful TDLS handshake.
--- net/mac80211/tdls.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/mac80211/tdls.c +3 -2
@@ -1457,8 +1457,9 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,set_sta_flag (sta,WLAN_STA_TDLS_PEER_AUTH ); -WARN_ON_ONCE (is_zero_ether_addr (sdata->u.mgd.tdls_peer) || - !ether_addr_equal (sdata->u.mgd.tdls_peer, peer)); +if (is_zero_ether_addr (sdata->u.mgd.tdls_peer) || + !ether_addr_equal (sdata->u.mgd.tdls_peer, peer)) +return -ENOLINK ;break ;case NL80211_TDLS_DISABLE_LINK :/*
Signature · 1 line
2.43.0
Johannes Berg
maintainernet/mac80211/tdls.c int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, · line 1462
Quoted 7 lines · Deepanshu Kartikey
net/mac80211/tdls.c +3
-2-WARN_ON_ONCE (is_zero_ether_addr (sdata->u.mgd.tdls_peer) || - !ether_addr_equal (sdata->u.mgd.tdls_peer, peer)); +if (is_zero_ether_addr (sdata->u.mgd.tdls_peer) || + !ether_addr_equal (sdata->u.mgd.tdls_peer, peer)) +return -ENOLINK ;
I think that check needs to be earlier, otherwise side effects happen (TDLS_PEER_AUTH flag).
Also, I'm a bit confused, how is it possible the sta_info_get() worked, but there's no TDLS? Maybe really what it needs is
sta = sta_info_get(sdata, peer);
- if (!sta)
+ if (!sta || !sta->sta.tdls)
return -ENOLINK;instead?
johannes
Quoted 12 lines · Johannes Berg
On Tue, 2026-03-10 at 21:30 +0530, Deepanshu Kartikey wrote:
I think that check needs to be earlier, otherwise side effects happen (TDLS_PEER_AUTHflag).Also, I'm a bit confused, how is it possible the
sta_info_get()worked, but there's no TDLS? Maybe really what it needs issta = sta_info_get(sdata, peer);(quoted diff) +1
-1- if (!sta) + if (!sta || !sta->sta.tdls) return -ENOLINK;
Quoted 3 lines
instead?
johannes
Thanks for the clarification. I have sent the v2 patch.
Deepanshu