]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: guard optional PMSR nominal time
authorZhao Li <enderaoelyther@gmail.com>
Wed, 8 Jul 2026 19:59:07 +0000 (03:59 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 21 Jul 2026 12:12:24 +0000 (14:12 +0200)
pmsr_parse_ftm() rejects a request that omits NOMINAL_TIME only for
non-trigger-based PD ranging. It then reads the attribute
unconditionally for every non-trigger-based request:

out->ftm.nominal_time =
nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME]);

For the other non-trigger-based request types NOMINAL_TIME is optional,
so tb[...] can be NULL and nla_get_u32() dereferences a NULL pointer.

Keep the requirement for PD ranging and read the nominal-time value only
when the attribute is present.

Fixes: 8823a9b0e7af ("wifi: cfg80211: add NTB continuous ranging and FTM request type support")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5
Assisted-by: Claude:opus-4.8
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20260708195911.84365-5-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/pmsr.c

index 34c3625f7fd5e51d34bb4c6ad6f9b0651ad231c6..d1e2fae5bc0e58a4454f8236c0aef089111a32c2 100644 (file)
@@ -263,8 +263,9 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev,
                                       "FTM: nominal time is required for PD NTB ranging");
                        return -EINVAL;
                }
-               out->ftm.nominal_time =
-                       nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME]);
+               if (tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME])
+                       out->ftm.nominal_time =
+                               nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME]);
 
                if (tb[NL80211_PMSR_FTM_REQ_ATTR_MIN_TIME_BETWEEN_MEASUREMENTS])
                        out->ftm.min_time_between_measurements =