cfg80211: don't require RTNL held for regdomain reads
authorJohannes Berg <johannes.berg@intel.com>
Tue, 27 Feb 2018 10:22:15 +0000 (11:22 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 29 Mar 2018 09:11:50 +0000 (11:11 +0200)
The whole code is set up to allow RCU reads of this data, but
then uses rtnl_dereference() which requires the RTNL. Convert
it to rcu_dereference_rtnl() which makes it require only RCU
or the RTNL, to allow RCU-protected reading of the data.

Reviewed-by: Coelho, Luciano <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/reg.c

index eddc834f63589e0ec2370e54125c8ef8da0e5b60..e352a0d1c4381e6901a1bde27e07d37873c28f4a 100644 (file)
@@ -135,12 +135,12 @@ static void restore_regulatory_settings(bool reset_user);
 
 static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
 {
-       return rtnl_dereference(cfg80211_regdomain);
+       return rcu_dereference_rtnl(cfg80211_regdomain);
 }
 
 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy)
 {
-       return rtnl_dereference(wiphy->regd);
+       return rcu_dereference_rtnl(wiphy->regd);
 }
 
 static const char *reg_dfs_region_str(enum nl80211_dfs_regions dfs_region)