Skip to content

Commit

Permalink
mac80211: use correct station flags lock
Browse files Browse the repository at this point in the history
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 eccb8e8, as it used
the wrong lock (thus not fixing the race that
was previously documented in a comment.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
  • Loading branch information
jmberg-intel authored and Andi Kleen committed Dec 14, 2010
1 parent b732c91 commit 0fe79ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mac80211/cfg.c
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 0fe79ff

Please sign in to comment.