Commit f5521b13 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: use correct station flags lock

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.)

Cc: stable@kernel.org [2.6.31+]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 39057512
...@@ -577,6 +577,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -577,6 +577,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
struct sta_info *sta, struct sta_info *sta,
struct station_parameters *params) struct station_parameters *params)
{ {
unsigned long flags;
u32 rates; u32 rates;
int i, j; int i, j;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
...@@ -585,7 +586,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -585,7 +586,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
sband = local->hw.wiphy->bands[local->oper_channel->band]; 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; mask = params->sta_flags_mask;
set = params->sta_flags_set; set = params->sta_flags_set;
...@@ -612,7 +613,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -612,7 +613,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
if (set & BIT(NL80211_STA_FLAG_MFP)) if (set & BIT(NL80211_STA_FLAG_MFP))
sta->flags |= WLAN_STA_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 * cfg80211 validates this (1-2007) and allows setting the AID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment