#include <linux/if.h>
#include <linux/module.h>
#include <linux/err.h>
-#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/nl80211.h>
#include <linux/debugfs.h>
if (!wiphy_idx_valid(wiphy_idx))
return NULL;
+ assert_cfg80211_lock();
+
list_for_each_entry(drv, &cfg80211_drv_list, list) {
if (drv->wiphy_idx == wiphy_idx) {
result = drv;
struct net_device *dev;
int err = -EINVAL;
+ assert_cfg80211_lock();
+
if (info->attrs[NL80211_ATTR_WIPHY]) {
bywiphyidx = cfg80211_drv_by_wiphy_idx(
nla_get_u32(info->attrs[NL80211_ATTR_WIPHY]));
#include <linux/netdevice.h>
#include <linux/kref.h>
#include <linux/rbtree.h>
+#include <linux/mutex.h>
#include <net/genetlink.h>
#include <net/wireless.h>
#include <net/cfg80211.h>
extern struct mutex cfg80211_mutex;
extern struct list_head cfg80211_drv_list;
+static inline void assert_cfg80211_lock(void)
+{
+ BUG_ON(!mutex_is_locked(&cfg80211_mutex));
+}
+
struct cfg80211_internal_bss {
struct list_head list;
struct rb_node rbn;
#include <linux/if.h>
#include <linux/module.h>
#include <linux/err.h>
-#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/if_ether.h>
#include <linux/ieee80211.h>
int i;
u16 ifmodes = dev->wiphy.interface_modes;
+ assert_cfg80211_lock();
+
hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_WIPHY);
if (!hdr)
return -1;
static bool regdom_changed(const char *alpha2)
{
+ assert_cfg80211_lock();
+
if (!cfg80211_regdomain)
return true;
if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
struct ieee80211_supported_band *sband;
struct ieee80211_channel *chan;
+ assert_cfg80211_lock();
+
sband = wiphy->bands[band];
BUG_ON(chan_idx >= sband->n_channels);
chan = &sband->channels[chan_idx];
static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
const char *alpha2)
{
+
+ assert_cfg80211_lock();
+
/* All initial requests are respected */
if (!last_request)
return 0;
bool intersect = false;
int r = 0;
+ assert_cfg80211_lock();
+
r = ignore_request(wiphy, set_by, alpha2);
if (r == REG_INTERSECT) {
static bool reg_same_country_ie_hint(struct wiphy *wiphy,
u32 country_ie_checksum)
{
+ assert_cfg80211_lock();
+
if (!last_request->wiphy)
return false;
if (likely(last_request->wiphy != wiphy))
{
int r;
+ assert_cfg80211_lock();
+
/* Note that this doesn't update the wiphys, this is done below */
r = __set_regdom(rd);
if (r) {
/* Caller must hold cfg80211_mutex */
void reg_device_remove(struct wiphy *wiphy)
{
+ assert_cfg80211_lock();
+
kfree(wiphy->regd);
if (!last_request || !last_request->wiphy)
return;