diff options
author | Masashi Honma <masashi.honma@gmail.com> | 2019-10-21 16:50:45 +0900 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-10-30 10:07:22 +0100 |
commit | ec649fed66bb242cca145ab364485c5a126efc53 (patch) | |
tree | 745bafb2a61d280f07c43b8b0643fc07488dd628 /net/wireless/chan.c | |
parent | 6f74a55d49004df760381df525f14edf018a640f (diff) | |
download | linux-rpi-ec649fed66bb242cca145ab364485c5a126efc53.tar.gz linux-rpi-ec649fed66bb242cca145ab364485c5a126efc53.tar.bz2 linux-rpi-ec649fed66bb242cca145ab364485c5a126efc53.zip |
nl80211: Disallow setting of HT for channel 14
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>
Diffstat (limited to 'net/wireless/chan.c')
-rw-r--r-- | net/wireless/chan.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index e851cafd8e2f..fcac5c6366e1 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -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; |