/*
* Central wireless core regulatory domains, we only need two,
* the current one and a world regulatory domain in case we have no
- * information to give us an alpha2
+ * information to give us an alpha2.
+ * Protected by the cfg80211_mutex.
*/
const struct ieee80211_regdomain *cfg80211_regdomain;
/*
* Protects static reg.c components:
* - cfg80211_world_regdom
- * - cfg80211_regdom
* - last_request
* - reg_num_devs_support_basehint
*/
static void reset_regdomains(bool full_reset)
{
+ assert_cfg80211_lock();
+ assert_reg_lock();
+
/* avoid freeing static information or freeing something twice */
if (cfg80211_regdomain == cfg80211_world_regdom)
cfg80211_regdomain = NULL;
{
WARN_ON(!last_request);
+ assert_cfg80211_lock();
+ assert_reg_lock();
+
reset_regdomains(false);
cfg80211_world_regdom = rd;
/* Used by nl80211 before kmalloc'ing our regulatory domain */
bool reg_is_valid_request(const char *alpha2)
{
- assert_cfg80211_lock();
-
if (!last_request)
return false;
{
bool val;
- assert_cfg80211_lock();
-
mutex_lock(®_mutex);
val = reg_request_cell_base(last_request);
mutex_unlock(®_mutex);
bool channel_changed = false;
struct ieee80211_channel chan_before;
- assert_cfg80211_lock();
-
sband = wiphy->bands[reg_beacon->chan.band];
chan = &sband->channels[chan_idx];
unsigned int i;
struct ieee80211_supported_band *sband;
- assert_cfg80211_lock();
-
if (!wiphy->bands[reg_beacon->chan.band])
return;
struct ieee80211_supported_band *sband;
struct reg_beacon *reg_beacon;
- assert_cfg80211_lock();
-
list_for_each_entry(reg_beacon, ®_beacon_list, list) {
if (!wiphy->bands[reg_beacon->chan.band])
continue;
static bool reg_is_world_roaming(struct wiphy *wiphy)
{
+ assert_cfg80211_lock();
+
if (is_world_regdom(cfg80211_regdomain->alpha2) ||
(wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
return true;
struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
unsigned int i;
- assert_cfg80211_lock();
-
if (!is_ht40_allowed(channel)) {
channel->flags |= IEEE80211_CHAN_NO_HT40;
return;
{
enum ieee80211_band band;
+ assert_cfg80211_lock();
assert_reg_lock();
if (ignore_reg_update(wiphy, initiator))
{
struct wiphy *last_wiphy = NULL;
- assert_cfg80211_lock();
-
/* All initial requests are respected */
if (!last_request)
return REG_REQ_OK;
void wiphy_regulatory_register(struct wiphy *wiphy)
{
- assert_cfg80211_lock();
-
mutex_lock(®_mutex);
if (!reg_dev_ignore_cell_hint(wiphy))
{
struct wiphy *request_wiphy = NULL;
- assert_cfg80211_lock();
-
mutex_lock(®_mutex);
if (!reg_dev_ignore_cell_hint(wiphy))