[PATCH wireless] wifi: cfg80211: don't call CRDA for a country regdb lacks
From: Devin Wittmayer
Date: Mon Nov 16 2026 - 01:07:45 EST
Connecting to an AP that advertises the country "EU", seen on
Vodafone routers, looks up a country that isn't in regulatory.db.
The lookup falls back to CRDA, nothing answers, and the CRDA timeout
then restores the world domain and drops the user's setting.
CRDA has the same data, so don't ask it for a country that the
loaded regulatory.db lacks.
Fixes: 007f6c5e6eb4 ("cfg80211: support loading regulatory database as firmware file")
Reported-by: Martin Moosbauer <martinmoosbauer@xxxxxxxxxxx>
Link: https://lore.kernel.org/linux-wireless/8db36875c56cd9703dee42c7a00b81c9@xxxxxxxxxxx/
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Devin Wittmayer <lucid_duck@xxxxxxxxxxxxx>
---
Connecting to an AP whose beacons carry Country "EU", with a user
country set:
kernel card before after
7.4-rc1 MT7925, USB world after 3s kept
7.3.4 (Fedora) MT7927, PCIe world after 3s kept
6.18.52, 6.18.63 (Arch) MT7925, USB world after 3s kept
6.12, 6.6, 6.1, 5.15, 5.10 (Arch) MT7612, USB world after 3s kept
"iw reg set EU" did the same and is now ignored, with no CRDA
request. A CA element is still applied, and with regulatory.db
missing or broken, CRDA is asked as before.
Before 7.4 the database pointer isn't RCU protected, so stable trees
need the plain pointer in the check. That form is what ran on 7.3 and
older above.
net/wireless/reg.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5cd3880ee384..cf79059b9992 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1125,9 +1125,16 @@ int reg_reload_regdb(void)
static bool reg_query_database(struct regulatory_request *request)
{
- if (query_regdb_file(request->alpha2) == 0)
+ int err;
+
+ err = query_regdb_file(request->alpha2);
+ if (!err)
return true;
+ /* CRDA has the same data, it won't have this country either */
+ if (err == -ENODATA && !IS_ERR_OR_NULL(rcu_access_pointer(global_regdb)))
+ return false;
+
if (call_crda(request->alpha2) == 0)
return true;
base-commit: 831e33ad02ff884ecc793c07a9c9bd9e06941fe5
--
2.56.1