]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
wireless: regulatory: fix channel disabling race condition
authorJohannes Berg <johannes.berg@intel.com>
Tue, 16 Apr 2013 12:32:26 +0000 (14:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:08:23 +0000 (20:08 -0700)
commit 990de49f74e772b6db5208457b7aa712a5f4db86 upstream.

When a full scan 2.4 and 5 GHz scan is scheduled, but then the 2.4 GHz
part of the scan disables a 5.2 GHz channel due to, e.g. receiving
country or frequency information, that 5.2 GHz channel might already
be in the list of channels to scan next. Then, when the driver checks
if it should do a passive scan, that will return false and attempt an
active scan. This is not only wrong but can also lead to the iwlwifi
device firmware crashing since it checks regulatory as well.

Fix this by not setting the channel flags to just disabled but rather
OR'ing in the disabled flag. That way, even if the race happens, the
channel will be scanned passively which is still (mostly) correct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/wireless/reg.c

index 82c4fc7c994cbe3a0dc89b4a6708f873fcc783d9..91ef82b4f94ef70e91cf5d413735a5e9d72c8068 100644 (file)
@@ -883,7 +883,7 @@ static void handle_channel(struct wiphy *wiphy,
                        return;
 
                REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq);
-               chan->flags = IEEE80211_CHAN_DISABLED;
+               chan->flags |= IEEE80211_CHAN_DISABLED;
                return;
        }