From: Johannes Berg Date: Sat, 1 Mar 2008 18:32:18 +0000 (+0100) Subject: mac80211: always insert key into list X-Git-Tag: v2.6.26-rc1~1138^2~454^2~55 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=96c46546e28282a743b97f26e94c7565350898b7;p=linux-2.6-omap-h63xx.git 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: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 166d0f00d13..f91fb409265 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -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 { @@ -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); }