summaryrefslogtreecommitdiff
path: root/net/mac80211/iface.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-06-06 14:49:27 +0200
committerJohannes Berg <johannes.berg@intel.com>2023-06-07 19:53:21 +0200
commita3df43b16fc49213ab4b925711d4725e1e2f2305 (patch)
tree456e9be1559a859c560e265a7ffc193d2ce4d491 /net/mac80211/iface.c
parent16114496d684a3df4ce09f7c6b7557a8b2922795 (diff)
wifi: mac80211: unregister netdevs through cfg80211
Since we want to have wiphy_lock() for the unregistration in the future, unregister also netdevs via cfg80211 now to be able to hold the wiphy_lock() for it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r--net/mac80211/iface.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index f820098e6a70..5b67b44e3f89 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -2258,7 +2258,6 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
{
struct ieee80211_sub_if_data *sdata, *tmp;
LIST_HEAD(unreg_list);
- LIST_HEAD(wdev_list);
ASSERT_RTNL();
@@ -2281,23 +2280,18 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
ieee80211_txq_teardown_flows(local);
mutex_lock(&local->iflist_mtx);
- list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
- list_del(&sdata->list);
-
- if (sdata->dev)
- unregister_netdevice_queue(sdata->dev, &unreg_list);
- else
- list_add(&sdata->list, &wdev_list);
- }
+ list_splice_init(&local->interfaces, &unreg_list);
mutex_unlock(&local->iflist_mtx);
- unregister_netdevice_many(&unreg_list);
-
wiphy_lock(local->hw.wiphy);
- list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
+ list_for_each_entry_safe(sdata, tmp, &unreg_list, list) {
+ bool netdev = sdata->dev;
+
list_del(&sdata->list);
cfg80211_unregister_wdev(&sdata->wdev);
- kfree(sdata);
+
+ if (!netdev)
+ kfree(sdata);
}
wiphy_unlock(local->hw.wiphy);
}