wifi: cfg80211: validate PMSR FTM preamble range
PATCH 1/1 wifi: cfg80211: validate PMSR FTM preamble range
PMSR FTM request parsing accepts preamble values outside the enumerated nl80211 preamble range.
Reject out-of-range values before using them in the parser capability bit test, and also update the nested preamble policy declaration to match the same enum range.
Fixes 9bb7e0f24e7e7 ("cfg80211: add peer measurement with FTM initiator API")
Assisted-by Codex:gpt-5.5
Assisted-by Claude:claude-opus-4.8
Signed-off-by Zhao Li <[email protected]>
--- net/wireless/nl80211.c | 4 +++- net/wireless/pmsr.c | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
net/wireless/nl80211.c +3 -1
@@ -461,7 +461,9 @@ nl80211_ftm_responder_policy[NL80211_FTM_RESP_ATTR_MAX + 1] = {static const struct nla_policy nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX +1 ] = { [NL80211_PMSR_FTM_REQ_ATTR_ASAP ] = { .type =NLA_FLAG }, - [NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE ] = { .type =NLA_U32 }, + [NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE ] = +NLA_POLICY_RANGE (NLA_U32 ,NL80211_PREAMBLE_LEGACY , +NL80211_PREAMBLE_HE ), [NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP ] =NLA_POLICY_MAX (NLA_U8 ,15 ), [NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD ] = { .type =NLA_U16 },
net/wireless/pmsr.c +7 -0
@@ -29,6 +29,13 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev,if (tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE ]) preamble =nla_get_u32 (tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE ]); +if (preamble >NL80211_PREAMBLE_HE ) { +NL_SET_ERR_MSG_ATTR (info->extack, + tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE ], +"FTM: invalid preamble" ); +return -EINVAL ; + } +/* set up values - struct is 0-initialized */ out->ftm.requested = true;
Signature · 1 line
2.50.1 (Apple Git-155)