From 1a82eea843ae255496c5a8ff6302d00243fb6703 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sun, 11 Oct 2026 11:31:33 +0200 Subject: [PATCH] wifi: mac80211: fix interface registration error path order If we fail to register the inet/inet6 address notifiers, wiphy_unregister() is called before removing interface, but the default interface already exists at this point. This could also lead to a deadlock as wiphy_unregister() then waits for the interface to go away. Change the order to remove the interfaces first. Assisted-by: LLM Link: https://patch.msgid.link/20261011113308.c2cb32bf3160.Ib46993671ae3030950360ea378a507cef2bd4117@changeid Signed-off-by: Johannes Berg --- net/mac80211/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 28480f983932..76e85754deff 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1683,12 +1683,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) #if defined(CONFIG_INET) || defined(CONFIG_IPV6) fail_ifa: #endif - wiphy_unregister(local->hw.wiphy); - fail_wiphy_register: - fail_band: rtnl_lock(); ieee80211_remove_interfaces(local); rtnl_unlock(); + wiphy_unregister(local->hw.wiphy); + fail_wiphy_register: + fail_band: rate_control_deinitialize(local); fail_rate: ieee80211_txq_teardown_flows(local);