]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: cfg80211: check non-S1G width with S1G chandef
authorLachlan Hodges <lachlan.hodges@morsemicro.com>
Thu, 12 Mar 2026 04:58:04 +0000 (15:58 +1100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 13 Mar 2026 06:14:26 +0000 (07:14 +0100)
It is not valid to have an S1G chandef with a non-S1G width. Enforce
this during chandef validation.

Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
Link: https://patch.msgid.link/20260312045804.362974-4-lachlan.hodges@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/chan.c

index 3e483fb27c4ed3f3d983460d86f014d4febabd1c..fa0764ede9c59bfac9a0acc11d44e87887d7c5c5 100644 (file)
@@ -405,6 +405,14 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
 
        control_freq = chandef->chan->center_freq;
 
+       if (cfg80211_chandef_is_s1g(chandef) &&
+           chandef->width != NL80211_CHAN_WIDTH_1 &&
+           chandef->width != NL80211_CHAN_WIDTH_2 &&
+           chandef->width != NL80211_CHAN_WIDTH_4 &&
+           chandef->width != NL80211_CHAN_WIDTH_8 &&
+           chandef->width != NL80211_CHAN_WIDTH_16)
+               return false;
+
        switch (chandef->width) {
        case NL80211_CHAN_WIDTH_5:
        case NL80211_CHAN_WIDTH_10: