Connecting to an AP that advertises a country regulatory.db doesn't have, like the "EU" some Vodafone routers send, makes cfg80211 ask CRDA. Nothing answers, and the timeout restores the world domain and forgets the country the user set. Forgetting it made sense when only user requests had a timeout. Do it only when the request that went unanswered came from the user. Fixes: eeca9fce1d71 ("cfg80211: Schedule timeout for all CRDA calls") Reported-by: Martin Moosbauer Link: https://lore.kernel.org/linux-wireless/8db36875c56cd9703dee42c7a00b81c9@vivaldi.net/ Cc: stable@vger.kernel.org Signed-off-by: Devin Wittmayer --- Connecting to an AP whose beacons carry Country "EU", with a user country set: kernel card without with 7.4-rc1, wireless/main MT7612, USB world, US lost back <1 s 7.3.4 (Fedora) MT7927, PCIe world, CA lost back <1 s 6.18.63 (Arch) MT7612, USB world, US lost back <1 s 6.18.52 (Arch) MT7925, USB world, US lost back <1 s 6.12 6.6 6.1 5.15 5.10 Arch MT7612, USB world, US lost back <1 s On stock, a 5 GHz AP running at the time is shut down a minute later. With the change it stays up, and a transfer running across the reset keeps its rate. A CA element still applies, and the user's own unanswered request still resets everything. With no regulatory.db at all, CRDA is asked as often as before. This replaces [1], which tied the two lookups together. Below 7.4 the timeout takes the RTNL instead, and that version is what ran on 7.3 and older above. [1] https://lore.kernel.org/all/20261116060723.37130-1-lucid_duck@justthetip.ca/ net/wireless/reg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5cd3880ee384..1dde03ce16a5 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -526,10 +526,14 @@ static DECLARE_DELAYED_WORK(crda_timeout, crda_timeout_work); static void crda_timeout_work(struct work_struct *work) { + struct regulatory_request *lr; + pr_debug("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); mutex_lock(&cfg80211_mutex); reg_crda_timeouts++; - restore_regulatory_settings(true, false); + lr = get_last_request(); + restore_regulatory_settings(lr->initiator == NL80211_REGDOM_SET_BY_USER, + false); mutex_unlock(&cfg80211_mutex); } base-commit: 763b13f622e2758726e8e3ecaef819db8fa0430a -- 2.56.1