Skip to contentSkip to conversation

wifi: mac80211: check tdls flag in ieee80211_tdls_oper

PATCH New Deepanshu Kartikey 1 participant 1 message Mar 13 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: mac80211: check tdls flag in ieee80211_tdls_oper

When NL80211_TDLS_ENABLE_LINK is called, the code only checks if the station exists but not whether it is actually a TDLS station. This allows the operation to proceed for non-TDLS stations, causing unintended side effects like modifying channel context and HT protection before failing.

Add a check for sta->sta.tdls early in the ENABLE_LINK case, before any side effects occur, to ensure the operation is only allowed for actual TDLS peers.

---
v2: Instead of replacing WARN_ON_ONCE with tdls_peer address check,
add early check for sta->sta.tdls flag before any side effects occur, as suggested by Johannes Berg.

---
 net/mac80211/tdls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tdls.c +1 -1
index dbbfe2d6842f..1dca2fae05a5 100644
@@ -1449,7 +1449,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
 		}
 
 		sta = sta_info_get(sdata, peer);
-		if (!sta)
+		if (!sta || !sta->sta.tdls)
 			return -ENOLINK;
 
 		iee80211_tdls_recalc_chanctx(sdata, sta);
Signature · 1 line
2.43.0