Skip to content

Commit

Permalink
mac80211: fix another key non-race
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and John W. Linville committed May 12, 2011
1 parent 5c0c364 commit 8cb2315
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8cb2315

Please sign in to comment.