diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-05-07 14:23:01 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-11 15:23:54 -0400 |
commit | 58905ca5b11a0ff3860f55b789cbbf052f7158a7 (patch) | |
tree | 7c7a4c937130855dfef41c2302deb7fb0b5a2eb7 /net/mac80211/iface.c | |
parent | 02018b39a75057541c7946a9173561d1a76a0bfe (diff) | |
download | linux-exynos-58905ca5b11a0ff3860f55b789cbbf052f7158a7.tar.gz linux-exynos-58905ca5b11a0ff3860f55b789cbbf052f7158a7.tar.bz2 linux-exynos-58905ca5b11a0ff3860f55b789cbbf052f7158a7.zip |
mac80211: fix scan channel race
When a software scan starts, it first sets sw_scanning, but
leaves the scan_channel "unset" (it currently actually gets
initialised to a default). Now, when something else tries
to (re)configure the hardware in the window between these two
events (after sw_scanning = true, but before scan_channel is
set), the current code switches to the (unset!) scan_channel.
This causes trouble, especially when switching bands and
sending frames on the wrong channel.
To work around this, leave scan_channel initialised to NULL
and use it to determine whether or not a switch to a different
channel should occur (and also use the same condition to check
whether to adjust power for scan or not).
Additionally, avoid reconfiguring the hardware completely when
recalculating idle resulted in no changes, this was the problem
that originally led us to discover the race condition in the
first place, which was helpfully bisected by Pavel. This part
of the patch should not be necessary with the other fixes, but
not calling the ieee80211_hw_config function when we know it to
be unnecessary is certainly a correct thing to do.
Unfortunately, this patch cannot and does not fix the race
condition completely, but due to the way the scan code is
structured it makes the particular problem Pavel discovered
(race while changing channel at the same time as transmitting
frames) go away. To fix it completely, more work especially
with locking configuration is needed.
Bisected-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r-- | net/mac80211/iface.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 8b6daf0219f4..8c9f1c722cdb 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -964,5 +964,6 @@ void ieee80211_recalc_idle(struct ieee80211_local *local) mutex_lock(&local->iflist_mtx); chg = __ieee80211_recalc_idle(local); mutex_unlock(&local->iflist_mtx); - ieee80211_hw_config(local, chg); + if (chg) + ieee80211_hw_config(local, chg); } |