Skip to contentSkip to conversation

wifi: nl80211: reject oversized EMA RNR element lists

PATCH Superseded Ren Wei 2 participants 2 messages May 27 1 message not in the archive 802.11 (including cfg80211/NL80211)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ren Wei

author
#1 lore raw

PATCH 1/1 wifi: nl80211: reject oversized EMA RNR element lists

From: Yuqi Xu <[email protected]>

nl80211_parse_rnr_elems() stores the parsed element count in a u8-backed cfg80211_rnr_elems::cnt field and uses that count to size the flexible array allocation.

Reject nested NL80211_ATTR_EMA_RNR_ELEMS input once the count reaches 255, before incrementing it again. This keeps the parser aligned with the data structure it fills and matches the existing bound check used by nl80211_parse_mbssid_elems().

Fixes dbbb27e183b1568d5a907ace1cd144b0709ea52a ("cfg80211: support RNR for EMA AP")
Assisted-by Codex:GPT-5.4
---
 net/wireless/nl80211.c | 3 +++
 1 file changed, 3 insertions(+)
net/wireless/nl80211.c +3 -0
index f334cdef8958..500eb84ff55a 100644
@@ -6354,6 +6354,9 @@ nl80211_parse_rnr_elems(struct wiphy *wiphy, struct nlattr *attrs,
 		if (ret)
 			return ERR_PTR(ret);
 
+		if (num_elems >= 255)
+			return ERR_PTR(-EINVAL);
+
 		num_elems++;
 	}
 
Signature · 1 line
2.54.0
maintainer
#2 lore raw
Quoted 6 lines · Ren Wei

From: Yuqi Xu <[email protected]>

nl80211_parse_rnr_elems() stores the parsed element count in a u8-backed cfg80211_rnr_elems::cnt field and uses that count to size the flexible array allocation.

Quoted 6 lines

Reject nested NL80211_ATTR_EMA_RNR_ELEMS input once the count reaches 255, before incrementing it again. This keeps the parser aligned with the data structure it fills and matches the existing bound check used by nl80211_parse_mbssid_elems().

Fixes dbbb27e183b1568d5a907ace1cd144b0709ea52a ("cfg80211: support RNR for EMA AP")

Please fix.

johannes