[PATCH wireless 1/4] wifi: mac80211: keep the monitor chanreq empty without a channel

From
Felix Fietkau <nbd@nbd.name>
Date
2026-11-06 15:46:58
ieee80211_do_stop() releases the channel of a monitor, but leaves its
chanreq filled. When the monitor comes back up it has no channel, yet
the RX path still filters on the old chanreq and drops all frames
received on other frequencies.

Only keep the chanreq filled while a channel is set on the monitor.

Fixes: f92e0cf19ae0 ("wifi: mac80211: filter on monitor interfaces based on configured channel")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/cfg.c   | 6 +++++-
 net/mac80211/iface.c | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9608c07bcea7..bb95173af405 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1165,8 +1165,12 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
 	ieee80211_link_release_channel(&sdata->deflink);
 	ret = ieee80211_link_use_channel(&sdata->deflink, &chanreq,
 					 IEEE80211_CHANCTX_SHARED);
-	if (ret)
+	if (ret) {
+		if (ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR))
+			memset(&sdata->vif.bss_conf.chanreq, 0,
+			       sizeof(sdata->vif.bss_conf.chanreq));
 		return ret;
+	}
 done:
 	local->monitor_chanreq = chanreq;
 	return 0;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index d0b0a503b229..de9250bf38b0 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -758,6 +758,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
 			break;
 
 		ieee80211_link_release_channel(&sdata->deflink);
+		memset(&sdata->vif.bss_conf.chanreq, 0,
+		       sizeof(sdata->vif.bss_conf.chanreq));
 		fallthrough;
 	default:
 		if (!going_down)
-- 
2.47.3
Thread (3 messages) 3 messages, 1 author, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help