diff options
author | Kieran Frewen <kieran.frewen@morsemicro.com> | 2022-04-20 07:13:21 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-05-04 12:33:39 +0300 |
commit | 5d087aa759eb82b8208411913f6c2158bd85abc0 (patch) | |
tree | e8a3b89b30e1b20fd31cb323dcd54ba0497ac6f9 /net | |
parent | 5e469ed9764d4722c59562da13120bd2dc6834c5 (diff) | |
download | linux-5d087aa759eb82b8208411913f6c2158bd85abc0.tar.xz |
nl80211: validate S1G channel width
Validate the S1G channel width input by user to ensure it matches
that of the requested channel
Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
Signed-off-by: Bassem Dawood <bassem@morsemicro.com>
Link: https://lore.kernel.org/r/20220420041321.3788789-2-kieran.frewen@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/nl80211.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 21e808fcb676..aa6094c3c9b0 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3173,6 +3173,15 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, } else if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { chandef->width = nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); + if (chandef->chan->band == NL80211_BAND_S1GHZ) { + /* User input error for channel width doesn't match channel */ + if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) { + NL_SET_ERR_MSG_ATTR(extack, + attrs[NL80211_ATTR_CHANNEL_WIDTH], + "bad channel width"); + return -EINVAL; + } + } if (attrs[NL80211_ATTR_CENTER_FREQ1]) { chandef->center_freq1 = nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]); |