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 <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2026-10-11 11:31:33 +02:00
parent 85a4a8e9c8
commit 1a82eea843

View File

@ -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);