wifi: mac80211: drop injection on disabled-chan monitor
authorJohannes Berg <johannes.berg@intel.com>
Tue, 6 Feb 2024 14:54:09 +0000 (16:54 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 12 Feb 2024 20:22:48 +0000 (21:22 +0100)
If the driver uses the new IEEE80211_CHAN_CAN_MONITOR, we
may monitor on channels that are, e.g. via regulatory,
otherwise considered disabled. However, we really shouldn't
transmit on them, so prevent that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240206164849.9c03dcf67dbe.Ib86a851c274c440908c663f6dd774b79bfc3965d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c

index 876de3ba98ba40cf1eed1523ac63ef3c8092c70c..373275d18f5a49ec0b747724bb68473c3112eb67 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  * Copyright 2007      Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- * Copyright (C) 2018-2022 Intel Corporation
+ * Copyright (C) 2018-2024 Intel Corporation
  *
  * Transmit and frame generation functions.
  */
@@ -2393,6 +2393,14 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
        else
                goto fail_rcu;
 
+       /*
+        * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
+        * shouldn't transmit on disabled channels.
+        */
+       if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
+                                    IEEE80211_CHAN_DISABLED))
+               goto fail_rcu;
+
        /*
         * Frame injection is not allowed if beaconing is not allowed
         * or if we need radar detection. Beaconing is usually not allowed when