Commit 96c46546 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: always insert key into list

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: default avatarJohannes Berg <>
Signed-off-by: default avatarJohn W. Linville <>
parent 38968d09
...@@ -174,6 +174,9 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, ...@@ -174,6 +174,9 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
{ {
int idx, defkey; int idx, defkey;
if (new)
list_add(&new->list, &sdata->key_list);
if (sta) { if (sta) {
rcu_assign_pointer(sta->key, new); rcu_assign_pointer(sta->key, new);
} else { } else {
...@@ -190,9 +193,6 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, ...@@ -190,9 +193,6 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
ieee80211_set_default_key(sdata, -1); ieee80211_set_default_key(sdata, -1);
rcu_assign_pointer(sdata->keys[idx], new); rcu_assign_pointer(sdata->keys[idx], new);
if (new)
list_add(&new->list, &sdata->key_list);
if (defkey && new) if (defkey && new)
ieee80211_set_default_key(sdata, new->conf.keyidx); ieee80211_set_default_key(sdata, new->conf.keyidx);
} }
Supports Markdown
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