]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
nl80211: Disallow setting of HT for channel 14
authorMasashi Honma <masashi.honma@gmail.com>
Mon, 21 Oct 2019 07:50:45 +0000 (16:50 +0900)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 30 Oct 2019 09:07:22 +0000 (10:07 +0100)
This patch disables setting of HT20 and more for channel 14 because
the channel is only for IEEE 802.11b.

The patch for net/wireless/util.c was unit-tested.

The patch for net/wireless/chan.c was tested with iw command.

Before this patch.
$ sudo iw dev <ifname> set channel 14 HT20
$

After this patch.
$ sudo iw dev <ifname> set channel 14 HT20
kernel reports: invalid channel definition
command failed: Invalid argument (-22)
$

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Link: https://lore.kernel.org/r/20191021075045.2719-1-masashi.honma@gmail.com
[clean up the code, use != instead of equivalent >]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/chan.c
net/wireless/util.c

index e851cafd8e2f631fb4461676155ed9210eea8ec1..fcac5c6366e16d5d40e69a4cdc9378c7ba926528 100644 (file)
@@ -204,6 +204,11 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
                return false;
        }
 
+       /* channel 14 is only for IEEE 802.11b */
+       if (chandef->center_freq1 == 2484 &&
+           chandef->width != NL80211_CHAN_WIDTH_20_NOHT)
+               return false;
+
        if (cfg80211_chandef_is_edmg(chandef) &&
            !cfg80211_edmg_chandef_valid(chandef))
                return false;
index 419eb12c1e932d17f072b75288a7726c8b96da52..5b4ed5bbc542555a4ebd4e8fcfbb6dccf10e9f3f 100644 (file)
@@ -1559,7 +1559,8 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
        }
 
        if (freq == 2484) {
-               if (chandef->width > NL80211_CHAN_WIDTH_40)
+               /* channel 14 is only for IEEE 802.11b */
+               if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT)
                        return false;
 
                *op_class = 82; /* channel 14 */