Skip to contentSkip to conversation

regulatory: use correct regulatory initiator on wiphy register

PATCH Applied Arik Nemtsov 4 participants 6 messages Jul 21, 2013 – Jul 25, 2013 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 regulatory: use correct regulatory initiator on wiphy register

The current regdomain was not always set by the core. This causes cards with a custom regulatory domain to ignore user initiated changes if done before the card was registered.

---
 net/wireless/reg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/wireless/reg.c +4 -1
index ddeff80..1ec3933 100644
@@ -2250,10 +2250,13 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 
 void wiphy_regulatory_register(struct wiphy *wiphy)
 {
+	struct regulatory_request *lr;
+
 	if (!reg_dev_ignore_cell_hint(wiphy))
 		reg_num_devs_support_basehint++;
 
-	wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
+	lr = get_last_request();
+	wiphy_update_regulatory(wiphy, lr->initiator);
 }
 
 void wiphy_regulatory_deregister(struct wiphy *wiphy)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 2/2 regulatory: take RTNL when restoring settings on CRDA timeout

The RTNL has to be held since this potentially changes the regdomain. Locking was forgotten here due to recent locking simplification changes.

---
 net/wireless/reg.c | 2 ++
 1 file changed, 2 insertions(+)
net/wireless/reg.c +2 -0
index 1ec3933..b25390a 100644
@@ -2285,7 +2285,9 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy)
 static void reg_timeout_work(struct work_struct *work)
 {
 	REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n");
+	rtnl_lock();
 	restore_regulatory_settings(true);
+	rtnl_unlock();
 }
 
 int __init regulatory_init(void)
Signature · 1 line
1.8.1.2
#3 lore raw

Re: [PATCH 2/2] regulatory: take RTNL when restoring settings on CRDA timeout

Quoted 7 lines · Sujith Manoharan
Quoted 2 lines · Arik Nemtsov

The RTNL has to be held since this potentially changes the regdomain. Locking was forgotten here due to recent locking simplification changes.

This is already present in the mac80211 tree:
https://git.kernel.org/cgit/linux/kernel/git/jberg/mac80211.git/commit/?id=f77b86d7d3acf9dfcb5ee834628d12207584b2cb

Ah thanks. I missed that. Disregard then please.

Arik

maintainer Applied
#5 lore raw
In reply to Arik Nemtsov
Quoted 3 lines · Arik Nemtsov

The current regdomain was not always set by the core. This causes cards with a custom regulatory domain to ignore user initiated changes if done before the card was registered.

Applied, thanks.

johannes