From: Johannes Berg Date: Tue, 14 Sep 2010 20:06:53 +0000 (+0200) Subject: mac80211: use correct station flags lock X-Git-Tag: v2.6.35.10~198 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0fe79ffa47b60778e71fc8b2dcfc30eb9681db30;p=karo-tx-linux.git mac80211: use correct station flags lock commit f5521b13880f4f4f612e1d20dd4f565122d16e04 upstream. This code is modifying the station flags, and as such should hold the flags lock so it can do so atomically vs. other flags modifications and readers. This issue was introduced when this code was added in eccb8e8f, as it used the wrong lock (thus not fixing the race that was previously documented in a comment.) Signed-off-by: Johannes Berg Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 67ee34f57df7..e8f3545ff8f4 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -639,6 +639,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, struct sta_info *sta, struct station_parameters *params) { + unsigned long flags; u32 rates; int i, j; struct ieee80211_supported_band *sband; @@ -647,7 +648,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, sband = local->hw.wiphy->bands[local->oper_channel->band]; - spin_lock_bh(&sta->lock); + spin_lock_irqsave(&sta->flaglock, flags); mask = params->sta_flags_mask; set = params->sta_flags_set; @@ -674,7 +675,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, if (set & BIT(NL80211_STA_FLAG_MFP)) sta->flags |= WLAN_STA_MFP; } - spin_unlock_bh(&sta->lock); + spin_unlock_irqrestore(&sta->flaglock, flags); /* * cfg80211 validates this (1-2007) and allows setting the AID