Skip to content

Commit 5d087aa

Browse files
Kieran Frewenjmberg-intel
authored andcommitted
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>
1 parent 5e469ed commit 5d087aa

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

net/wireless/nl80211.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,6 +3173,15 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
31733173
} else if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) {
31743174
chandef->width =
31753175
nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]);
3176+
if (chandef->chan->band == NL80211_BAND_S1GHZ) {
3177+
/* User input error for channel width doesn't match channel */
3178+
if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) {
3179+
NL_SET_ERR_MSG_ATTR(extack,
3180+
attrs[NL80211_ATTR_CHANNEL_WIDTH],
3181+
"bad channel width");
3182+
return -EINVAL;
3183+
}
3184+
}
31763185
if (attrs[NL80211_ATTR_CENTER_FREQ1]) {
31773186
chandef->center_freq1 =
31783187
nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]);

0 commit comments

Comments
 (0)