summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuqi Xu <xuyuqiabc@gmail.com>2026-05-29 23:25:37 +0800
committerJohannes Berg <johannes.berg@intel.com>2026-06-02 13:25:19 +0200
commit4cd92957e8f8cc4ebfe8a5d4203c14c592fde6b1 (patch)
tree95641117925e179a3e8e7231e43f0a1205a064ca
parentf3be0c984ecbcb82b0bec408022c4ef738cb3843 (diff)
downloadlinux-4cd92957e8f8cc4ebfe8a5d4203c14c592fde6b1.tar.gz
linux-4cd92957e8f8cc4ebfe8a5d4203c14c592fde6b1.zip
wifi: nl80211: reject oversized EMA RNR lists
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: dbbb27e183b1 ("cfg80211: support RNR for EMA AP") Cc: stable@kernel.org Reported-by: Yuan Tan <yuantan098@gmail.com> Reported-by: Zhengchuan Liang <zcliangcn@gmail.com> Reported-by: Xin Liu <bird@lzu.edu.cn> Assisted-by: Codex:gpt-5.4 Signed-off-by: Yuqi Xu <xuyuqiabc@gmail.com> Signed-off-by: Ren Wei <n05ec@lzu.edu.cn> Link: https://patch.msgid.link/20260529152542.1412734-1-n05ec@lzu.edu.cn Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/nl80211.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 7db9cd433801..dac2e8643c49 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6366,6 +6366,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++;
}