]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: cfg80211: restrict cfg80211_chandef_create() to only HT-based bands
authorLachlan Hodges <lachlan.hodges@morsemicro.com>
Thu, 12 Mar 2026 04:58:03 +0000 (15:58 +1100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 13 Mar 2026 06:14:26 +0000 (07:14 +0100)
cfg80211_chandef_create() should only be used by bands that are
HT-based and the chantype argument makes sense. Insert a WARN such
that it isn't used on 60GHz and S1GHz bands and to catch any
potential existing uses by those bands.

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

index e3c18a4392bb397d3c789599394cfdc7da1e6303..3e483fb27c4ed3f3d983460d86f014d4febabd1c 100644 (file)
@@ -29,9 +29,11 @@ void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
 
        *chandef = (struct cfg80211_chan_def) {
                .chan = chan,
-               .freq1_offset = chan->freq_offset,
        };
 
+       WARN_ON(chan->band == NL80211_BAND_60GHZ ||
+               chan->band == NL80211_BAND_S1GHZ);
+
        switch (chan_type) {
        case NL80211_CHAN_NO_HT:
                chandef->width = NL80211_CHAN_WIDTH_20_NOHT;