Skip to content

Commit

Permalink
mac80211: always insert key into list
Browse files Browse the repository at this point in the history
Today I hit one of my new WARN_ONs in the mac80211 code because
a key wasn't being freed correctly. After wondering for a while
I finally tracked it to the fact that STA keys aren't added to
the per-sdata key list correctly, they are supposed to always be
on that list, not just for default keys. This patch fixes that.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Mar 6, 2008
1 parent 38968d0 commit 96c4654
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
{
int idx, defkey;

if (new)
list_add(&new->list, &sdata->key_list);

if (sta) {
rcu_assign_pointer(sta->key, new);
} else {
Expand All @@ -190,9 +193,6 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
ieee80211_set_default_key(sdata, -1);

rcu_assign_pointer(sdata->keys[idx], new);
if (new)
list_add(&new->list, &sdata->key_list);

if (defkey && new)
ieee80211_set_default_key(sdata, new->conf.keyidx);
}
Expand Down

0 comments on commit 96c4654

Please sign in to comment.