summaryrefslogtreecommitdiff
path: root/net/mac80211/iface.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-08-28 13:59:41 +0200
committerJohannes Berg <johannes.berg@intel.com>2023-09-11 11:27:20 +0200
commit730538edc8e0eb14b02708f65100a0deaf43e6cd (patch)
tree265419703478bc1b65afd93f0021e677443ac876 /net/mac80211/iface.c
parentac2f7d6f2765a10b5075e0024706df7e845e7890 (diff)
wifi: mac80211: lock wiphy in IP address notifier
Lock the wiphy in the IP address notifier as another place that should have it locked before calling into the driver. This needs a bit of attention since the notifier can be called while the wiphy is already locked, when we remove an interface. Handle this by not running the notifier in this case, and instead calling out to the driver directly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r--net/mac80211/iface.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 42e130a6aee9..c0539e78a34e 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -2284,6 +2284,20 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
list_for_each_entry_safe(sdata, tmp, &unreg_list, list) {
bool netdev = sdata->dev;
+ /*
+ * Remove IP addresses explicitly, since the notifier will
+ * skip the callbacks if wdev->registered is false, since
+ * we can't acquire the wiphy_lock() again there if already
+ * inside this locked section.
+ */
+ sdata_lock(sdata);
+ sdata->vif.cfg.arp_addr_cnt = 0;
+ if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+ sdata->u.mgd.associated)
+ ieee80211_vif_cfg_change_notify(sdata,
+ BSS_CHANGED_ARP_FILTER);
+ sdata_unlock(sdata);
+
list_del(&sdata->list);
cfg80211_unregister_wdev(&sdata->wdev);