2020-09-28 07:32:33

by Rajkumar Manoharan

[permalink] [raw]
Subject: [PATCH 1/2] nl80211: fix OBSS PD min and max offset validation

The SRG min and max offset won't present when SRG Information Present of
SR control field of Spatial Reuse Parameter Set element set to 0. Per
spec. IEEE802.11ax D7.0, SRG OBSS PD Min Offset ≤ SRG OBSS PD Max
Offset. Hence fix the constrain check to allow same values in both
offset and also call appropriate nla_get function to read the values.

Fixes: 796e90f42b7e ("cfg80211: add support for parsing OBBS_PD
attributes")
Signed-off-by: Rajkumar Manoharan <[email protected]>
---
net/wireless/nl80211.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 666274f36d63..e7b84e36014c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4871,16 +4871,14 @@ static int nl80211_parse_he_obss_pd(struct nlattr *attrs,
if (err)
return err;

- if (!tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET] ||
- !tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET])
- return -EINVAL;
-
- he_obss_pd->min_offset =
- nla_get_u32(tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]);
- he_obss_pd->max_offset =
- nla_get_u32(tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]);
-
- if (he_obss_pd->min_offset >= he_obss_pd->max_offset)
+ if (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET])
+ he_obss_pd->min_offset =
+ nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]);
+ if (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET])
+ he_obss_pd->max_offset =
+ nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]);
+
+ if (he_obss_pd->min_offset > he_obss_pd->max_offset)
return -EINVAL;

he_obss_pd->enable = true;
--
2.7.4


2020-10-09 15:33:39

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] nl80211: fix OBSS PD min and max offset validation

Rajkumar Manoharan <[email protected]> writes:

> The SRG min and max offset won't present when SRG Information Present of
> SR control field of Spatial Reuse Parameter Set element set to 0. Per
> spec. IEEE802.11ax D7.0, SRG OBSS PD Min Offset ≤ SRG OBSS PD Max
> Offset. Hence fix the constrain check to allow same values in both
> offset and also call appropriate nla_get function to read the values.
>
> Fixes: 796e90f42b7e ("cfg80211: add support for parsing OBBS_PD
> attributes")

Fixes tag should be in one line.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches