Merge tag 'jfs-3.10-rc5' of git://github.com/kleikamp/linux-shaggy
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / rate.c
index 0d51877efdb74260b07f33935ce2101df6f57678..d3f414fe67e0beb9592e87d344a6b3a5c0fed66b 100644 (file)
@@ -688,8 +688,15 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
                           struct ieee80211_sta *pubsta,
                           struct ieee80211_sta_rates *rates)
 {
-       struct ieee80211_sta_rates *old = rcu_dereference(pubsta->rates);
+       struct ieee80211_sta_rates *old;
 
+       /*
+        * mac80211 guarantees that this function will not be called
+        * concurrently, so the following RCU access is safe, even without
+        * extra locking. This can not be checked easily, so we just set
+        * the condition to true.
+        */
+       old = rcu_dereference_protected(pubsta->rates, true);
        rcu_assign_pointer(pubsta->rates, rates);
        if (old)
                kfree_rcu(old, rcu_head);