]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
cfg80211: move world roaming check for beacon hints
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>
Wed, 19 Dec 2012 18:53:04 +0000 (10:53 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 3 Jan 2013 12:01:38 +0000 (13:01 +0100)
We should not add new beacon hints even if the wiphy
is not world roaming. Without this we were always adding
a beacon hint if not world roaming for every non world
roaming wiphy interface.

Tested-by: Ben Greear <greearb@candelatech.com>
Reported-by: Ben Greear <greearb@candelatech.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[fix locking]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/reg.c

index b68eeef45e6caf1733f66b3ee0ccb39d34321f3a..0b35de00193786e723d93cac6663ab1318dade96 100644 (file)
@@ -1044,6 +1044,9 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
 
        chan->beacon_found = true;
 
+       if (!reg_is_world_roaming(wiphy))
+               return;
+
        if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
                return;
 
@@ -1110,8 +1113,6 @@ static void reg_process_beacons(struct wiphy *wiphy)
         */
        if (!last_request)
                return;
-       if (!reg_is_world_roaming(wiphy))
-               return;
        wiphy_update_beacon_reg(wiphy);
 }
 
@@ -1593,11 +1594,8 @@ static void reg_process_pending_beacon_hints(void)
        struct cfg80211_registered_device *rdev;
        struct reg_beacon *pending_beacon, *tmp;
 
-       /*
-        * No need to hold the reg_mutex here as we just touch wiphys
-        * and do not read or access regulatory variables.
-        */
        mutex_lock(&cfg80211_mutex);
+       mutex_lock(&reg_mutex);
 
        /* This goes through the _pending_ beacon list */
        spin_lock_bh(&reg_pending_beacons_lock);
@@ -1615,6 +1613,7 @@ static void reg_process_pending_beacon_hints(void)
        }
 
        spin_unlock_bh(&reg_pending_beacons_lock);
+       mutex_unlock(&reg_mutex);
        mutex_unlock(&cfg80211_mutex);
 }