From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: always insert key into list
Date: Sat, 01 Mar 2008 19:32:18 +0100 [thread overview]
Message-ID: <1204396338.3917.9.camel@johannes.berg> (raw)
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>
---
John, please merge soon, the ultimate consequence of this bug is that
when trying to delete everything mac80211 segfaults with an access to
already freed memory because the key is freed but still thought to
belong to a STA.
net/mac80211/key.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- everything.orig/net/mac80211/key.c 2008-03-01 19:28:56.000000000 +0100
+++ everything/net/mac80211/key.c 2008-03-01 19:29:00.000000000 +0100
@@ -174,6 +174,9 @@ static void __ieee80211_key_replace(stru
{
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(stru
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);
}
next reply other threads:[~2008-03-01 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 18:32 Johannes Berg [this message]
2008-03-01 18:57 ` [PATCH] mac80211: always insert key into list drago01
2008-03-01 20:56 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204396338.3917.9.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox