diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-01-09 10:22:07 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-01-09 12:19:43 +0100 |
commit | 4a484cffc5e1836114e9556f7c704412d491200c (patch) | |
tree | db228d48bc1c0b8244892d2a329b514da167f339 /net/wireless | |
parent | c51f878379b1d0677619798b1d9358d053bdbdb1 (diff) | |
download | blackbird-op-linux-4a484cffc5e1836114e9556f7c704412d491200c.tar.gz blackbird-op-linux-4a484cffc5e1836114e9556f7c704412d491200c.zip |
regulatory: fix uevent
The uevent callback doesn't protect its access to
last_request, which now causes a warning since
the conversion to get_last_request(). Fix this by
allowing to use RCU protection for last_request.
Reported-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/reg.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 0b35de001937..2193f62bb8ae 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -140,8 +140,8 @@ static void rcu_free_regdom(const struct ieee80211_regdomain *r) static struct regulatory_request *get_last_request(void) { - return rcu_dereference_protected(last_request, - lockdep_is_held(®_mutex)); + return rcu_dereference_check(last_request, + lockdep_is_held(®_mutex)); } /* Used to queue up regulatory hints */ @@ -2250,14 +2250,21 @@ int set_regdom(const struct ieee80211_regdomain *rd) #ifdef CONFIG_HOTPLUG int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) { - struct regulatory_request *lr = get_last_request(); + struct regulatory_request *lr; + u8 alpha2[2]; + bool add = false; + rcu_read_lock(); + lr = get_last_request(); if (lr && !lr->processed) { - if (add_uevent_var(env, "COUNTRY=%c%c", - lr->alpha2[0], lr->alpha2[1])) - return -ENOMEM; + memcpy(alpha2, lr->alpha2, 2); + add = true; } + rcu_read_unlock(); + if (add) + return add_uevent_var(env, "COUNTRY=%c%c", + alpha2[0], alpha2[1]); return 0; } #else |