summaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-05-12 15:07:15 +0200
committerJohn W. Linville <linville@tuxdriver.com>2011-05-12 20:10:54 +0200
commit8cb231530f03961b55aa4e84e6ead5590bcde04d (patch)
tree62e94c7423bbb073640fe4fe8454ba5135b0ebc8 /net/mac80211
parentmac80211: make key locking clearer (diff)
downloadlinux-8cb231530f03961b55aa4e84e6ead5590bcde04d.tar.xz
linux-8cb231530f03961b55aa4e84e6ead5590bcde04d.zip
mac80211: fix another key non-race
The code here is only not racy because all the places that assign the pointers it uses are holding the sta_mtx as well as the key_mtx and so can't race against this because this code holds the sta_mtx. But that's not intuitive, so fix it to hold the key_mtx. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/sta_info.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f05244dc773e..cba8309e9ace 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -652,10 +652,12 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
if (ret)
return ret;
+ mutex_lock(&local->key_mtx);
for (i = 0; i < NUM_DEFAULT_KEYS; i++)
- ieee80211_key_free(local, sta->gtk[i]);
+ __ieee80211_key_free(sta->gtk[i]);
if (sta->ptk)
- ieee80211_key_free(local, sta->ptk);
+ __ieee80211_key_free(sta->ptk);
+ mutex_unlock(&local->key_mtx);
sta->dead = true;