]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/wireless/reg.c
cfg80211: hold reg_mutex when updating regulatory
[mirror_ubuntu-bionic-kernel.git] / net / wireless / reg.c
index a2b09c2df1bf8cefa0ff380e6fb72430ac7063d6..a1f069da79a40265d194270d126c20f914353b93 100644 (file)
@@ -101,6 +101,9 @@ struct reg_beacon {
        struct ieee80211_channel chan;
 };
 
+static void wiphy_update_regulatory(struct wiphy *wiphy,
+                                   enum nl80211_reg_initiator initiator);
+
 static void reg_todo(struct work_struct *work);
 static DECLARE_WORK(reg_work, reg_todo);
 
@@ -1118,11 +1121,13 @@ static void reg_process_ht_flags(struct wiphy *wiphy)
 
 }
 
-void wiphy_update_regulatory(struct wiphy *wiphy,
-                            enum nl80211_reg_initiator initiator)
+static void wiphy_update_regulatory(struct wiphy *wiphy,
+                                   enum nl80211_reg_initiator initiator)
 {
        enum ieee80211_band band;
 
+       assert_reg_lock();
+
        if (ignore_reg_update(wiphy, initiator))
                return;
 
@@ -1137,6 +1142,14 @@ void wiphy_update_regulatory(struct wiphy *wiphy,
                wiphy->reg_notifier(wiphy, last_request);
 }
 
+void regulatory_update(struct wiphy *wiphy,
+                      enum nl80211_reg_initiator setby)
+{
+       mutex_lock(&reg_mutex);
+       wiphy_update_regulatory(wiphy, setby);
+       mutex_unlock(&reg_mutex);
+}
+
 static void handle_channel_custom(struct wiphy *wiphy,
                                  enum ieee80211_band band,
                                  unsigned int chan_idx,