mirror of
https://github.com/openwrt/openwrt.git
synced 2026-11-27 16:50:30 +04:00
mac80211: backport the fix of the monitor filter refcount leak
ieee80211_do_open() counts the flags of every monitor interface in
local->fif_* and local->tx_mntrs, but ieee80211_do_stop() takes them back
only for a monitor that is neither active nor on a NO_VIRTUAL_MONITOR
driver. For an active monitor, and for each monitor on a
NO_VIRTUAL_MONITOR driver such as mt7996, the counts stay up after the
monitor is closed, until the module reloads. mt7996 then keeps passing
FCS-failed frames, control frames and frames of other BSSes, and mac80211
keeps passing each TX status to ieee80211_tx_monitor().
Backport commit feb3a036d1cd ("wifi: mac80211: fix monitor filter
refcount leak") from wireless-next.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
1 parent
244ac7a653
commit
cb892a547f
7 files changed
+43
-11
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
From feb3a036d1cd7b708969dfc58feed16c51a496dc Mon Sep 17 00:00:00 2001
|
||||
From: Devin Wittmayer <lucid_duck@justthetip.ca>
|
||||
Date: Fri, 4 Sep 2026 13:28:17 -0700
|
||||
Subject: [PATCH] wifi: mac80211: fix monitor filter refcount leak
|
||||
|
||||
When bringing a monitor interface up and down again, the
|
||||
refcount is leaked for active monitor interfaces, so the
|
||||
hardware filter is never reset.
|
||||
|
||||
Move the decrement out so it mirrors the increment.
|
||||
|
||||
Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
|
||||
Link: https://patch.msgid.link/20260904202817.12564-1-lucid_duck@justthetip.ca
|
||||
[rewrite commit message better]
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
---
|
||||
net/mac80211/iface.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -630,8 +630,9 @@ static void ieee80211_do_stop(struct iee
|
||||
hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR;
|
||||
}
|
||||
|
||||
- ieee80211_adjust_monitor_flags(sdata, -1);
|
||||
}
|
||||
+
|
||||
+ ieee80211_adjust_monitor_flags(sdata, -1);
|
||||
break;
|
||||
case NL80211_IFTYPE_NAN:
|
||||
/* Check if any open NAN_DATA interfaces */
|
||||
+1
-1
@@ -29,7 +29,7 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -1610,8 +1610,12 @@ int ieee80211_do_open(struct wireless_de
|
||||
@@ -1611,8 +1611,12 @@ int ieee80211_do_open(struct wireless_de
|
||||
err_del_interface:
|
||||
drv_remove_interface(local, sdata);
|
||||
err_stop:
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
goto do_survey;
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -1035,7 +1035,7 @@ static int ieee80211_netdev_fill_forward
|
||||
@@ -1036,7 +1036,7 @@ static int ieee80211_netdev_fill_forward
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
ieee80211_uhr_cap_ie_to_sta_uhr_cap(struct ieee80211_sub_if_data *sdata,
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -786,60 +786,68 @@ static void ieee80211_do_stop(struct iee
|
||||
@@ -787,60 +787,68 @@ static void ieee80211_do_stop(struct iee
|
||||
ieee80211_add_virtual_monitor(local, NULL);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
local->fif_pspoll--;
|
||||
local->fif_probe_req--;
|
||||
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
|
||||
@@ -1422,6 +1424,10 @@ int ieee80211_do_open(struct wireless_de
|
||||
@@ -1423,6 +1425,10 @@ int ieee80211_do_open(struct wireless_de
|
||||
break;
|
||||
}
|
||||
case NL80211_IFTYPE_AP:
|
||||
@@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
@@ -1456,7 +1462,7 @@ int ieee80211_do_open(struct wireless_de
|
||||
@@ -1457,7 +1463,7 @@ int ieee80211_do_open(struct wireless_de
|
||||
* no need to worry about AP_VLAN/NAN_DATA cleanup since
|
||||
* in that case we can't have open_count == 0
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
}
|
||||
ieee80211_led_radio(local, true);
|
||||
ieee80211_mod_tpt_led_trig(local,
|
||||
@@ -1632,6 +1638,9 @@ int ieee80211_do_open(struct wireless_de
|
||||
@@ -1633,6 +1639,9 @@ int ieee80211_do_open(struct wireless_de
|
||||
list_del(&sdata->u.vlan.list);
|
||||
/* Might not be initialized yet, but it is harmless */
|
||||
sdata->bss = NULL;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -712,8 +712,15 @@ static void ieee80211_do_stop(struct iee
|
||||
@@ -713,8 +713,15 @@ static void ieee80211_do_stop(struct iee
|
||||
ieee80211_free_txskb(&local->hw, skb);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#ifdef CPTCFG_MAC80211_DEBUGFS
|
||||
--- a/net/mac80211/iface.c
|
||||
+++ b/net/mac80211/iface.c
|
||||
@@ -877,6 +877,8 @@ static int ieee80211_stop(struct net_dev
|
||||
@@ -878,6 +878,8 @@ static int ieee80211_stop(struct net_dev
|
||||
guard(wiphy)(sdata->local->hw.wiphy);
|
||||
|
||||
wiphy_work_cancel(sdata->local->hw.wiphy, &sdata->activate_links_work);
|
||||
@@ -63,7 +63,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
/* Close the dependent MBSSID interfaces with wiphy lock as we may be
|
||||
* terminating its partner links too in case of MLD.
|
||||
@@ -921,6 +923,9 @@ static void ieee80211_teardown_sdata(str
|
||||
@@ -922,6 +924,9 @@ static void ieee80211_teardown_sdata(str
|
||||
if (WARN_ON(!list_empty(&sdata->work.entry)))
|
||||
wiphy_work_cancel(sdata->local->hw.wiphy, &sdata->work);
|
||||
|
||||
@@ -73,7 +73,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/* free extra data */
|
||||
ieee80211_free_keys(sdata, false);
|
||||
|
||||
@@ -1909,6 +1914,35 @@ static void ieee80211_activate_links_wor
|
||||
@@ -1910,6 +1915,35 @@ static void ieee80211_activate_links_wor
|
||||
sdata->desired_active_links = 0;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/*
|
||||
* Helper function to initialise an interface to a specific type.
|
||||
*/
|
||||
@@ -1947,6 +1981,9 @@ static void ieee80211_setup_sdata(struct
|
||||
@@ -1948,6 +1982,9 @@ static void ieee80211_setup_sdata(struct
|
||||
wiphy_work_init(&sdata->work, ieee80211_iface_work);
|
||||
wiphy_work_init(&sdata->activate_links_work,
|
||||
ieee80211_activate_links_work);
|
||||
|
||||
Reference in new issue
Block a user