From: Johannes Berg The RTNL here is only needed for walking the wiphy list, which can be done under cfg80211_mutex instead, we just need to not take it in regulatory_hint_disconnect(), of which this is the only caller. Signed-off-by: Johannes Berg --- net/wireless/reg.c | 2 +- net/wireless/reg.h | 2 +- net/wireless/sme.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 4efb35baeb3e..50f50e768f01 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -3671,7 +3671,7 @@ static bool is_wiphy_all_set_reg_flag(enum ieee80211_regulatory_flags flag) void regulatory_hint_disconnect(void) { - guard(mutex)(&cfg80211_mutex); + lockdep_assert_held(&cfg80211_mutex); /* Restore of regulatory settings is not required when wiphy(s) * ignore IE from connected access point but clearance of beacon hints diff --git a/net/wireless/reg.h b/net/wireless/reg.h index c587079ead8f..76e7f9e8d684 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h @@ -115,7 +115,7 @@ void regulatory_hint_country_ie(struct wiphy *wiphy, * be respected but if a user had set the regulatory domain that will take * precedence. * - * Must be called from process context. + * Must be called with cfg80211_mutex held. */ void regulatory_hint_disconnect(void); diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 85076f3b3355..fde86c900f4f 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -704,10 +704,10 @@ static bool cfg80211_is_all_idle(void) static void disconnect_work(struct work_struct *work) { - rtnl_lock(); + guard(mutex)(&cfg80211_mutex); + if (cfg80211_is_all_idle()) regulatory_hint_disconnect(); - rtnl_unlock(); } DECLARE_WORK(cfg80211_disconnect_work, disconnect_work); -- 2.56.0