From: Johannes Berg Date: Wed, 22 Apr 2009 21:02:51 +0000 (+0200) Subject: mac80211: fix PS vs. scan race X-Git-Tag: v2.6.31-rc1~14^2~525^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5edaedc16ebd0635435dec068d49e07a76ba7d9;p=profile%2Fivi%2Fkernel-x86-ivi.git mac80211: fix PS vs. scan race When somebody changes the PS parameters while scanning is in progress, we enable PS -- during the scan. This is clearly not desirable, and we can just abort enabling PS when scanning since when the scan finishes it will be taken care of. Signed-off-by: Johannes Berg Reviewed-by: Kalle Valo Signed-off-by: John W. Linville --- diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 3610c11..2029b71 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -487,6 +487,13 @@ static void ieee80211_enable_ps(struct ieee80211_local *local, { struct ieee80211_conf *conf = &local->hw.conf; + /* + * If we are scanning right now then the parameters will + * take effect when scan finishes. + */ + if (local->hw_scanning || local->sw_scanning) + return; + if (conf->dynamic_ps_timeout > 0 && !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) { mod_timer(&local->dynamic_ps_timer, jiffies +