aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-01-29 19:34:46 +0100
committerJohannes Berg <johannes.berg@intel.com>2024-02-08 13:07:37 +0100
commitb9d908dc3a294d25c7d6c2f54ca3987cbd98f040 (patch)
tree702712d5b8945073f4b6120c9db8def0b8b99413 /net/wireless
parentc478db84c8544156b80c5e5d3a8c7840d557707a (diff)
downloadlinux-b9d908dc3a294d25c7d6c2f54ca3987cbd98f040.tar.gz
wifi: wireless: declare different S1G chandefs incompatible
It doesn't look like we can get into this code, but make it more robust and declare two S1G chandefs to be incompatible unless they're identical. Link: https://msgid.link/20240129194108.b28fb0644a8c.I9297ada5cf1baf00dbbdf8fcffd1806883489fc9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/chan.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 71f1bd456d88c..159b8aac451e3 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -465,13 +465,18 @@ cfg80211_chandef_compatible(const struct cfg80211_chan_def *c1,
return NULL;
/*
- * can't be compatible if one of them is 5 or 10 MHz,
+ * can't be compatible if one of them is 5/10 MHz or S1G
* but they don't have the same width.
*/
- if (c1->width == NL80211_CHAN_WIDTH_5 ||
- c1->width == NL80211_CHAN_WIDTH_10 ||
- c2->width == NL80211_CHAN_WIDTH_5 ||
- c2->width == NL80211_CHAN_WIDTH_10)
+#define NARROW_OR_S1G(width) ((width) == NL80211_CHAN_WIDTH_5 || \
+ (width) == NL80211_CHAN_WIDTH_10 || \
+ (width) == NL80211_CHAN_WIDTH_1 || \
+ (width) == NL80211_CHAN_WIDTH_2 || \
+ (width) == NL80211_CHAN_WIDTH_4 || \
+ (width) == NL80211_CHAN_WIDTH_8 || \
+ (width) == NL80211_CHAN_WIDTH_16)
+
+ if (NARROW_OR_S1G(c1->width) || NARROW_OR_S1G(c2->width))
return NULL;
if (c1->width == NL80211_CHAN_WIDTH_20_NOHT ||