public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix debugfs default key oops
@ 2008-05-02 23:04 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2008-05-02 23:04 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, Ivo van Doorn, Bas Gooijen

Under certain circumstances (in AP mode) the debugfs function
that is supposed to add the default key symlink can encounter
a NULL default_key pointer. This patch makes it handle that
situtation gracefully.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/debugfs_key.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

--- everything.orig/net/mac80211/debugfs_key.c	2008-04-30 19:54:02.000000000 +0200
+++ everything/net/mac80211/debugfs_key.c	2008-04-30 19:54:29.000000000 +0200
@@ -255,14 +255,23 @@ void ieee80211_debugfs_key_remove(struct
 void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
 {
 	char buf[50];
+	struct ieee80211_key *key;
 
 	if (!sdata->debugfsdir)
 		return;
 
-	sprintf(buf, "../keys/%d", sdata->default_key->debugfs.cnt);
-	sdata->debugfs.default_key =
-		debugfs_create_symlink("default_key", sdata->debugfsdir, buf);
+	/* this is running under the key lock */
+
+	key = sdata->default_key;
+	if (key) {
+		sprintf(buf, "../keys/%d", key->debugfs.cnt);
+		sdata->debugfs.default_key =
+			debugfs_create_symlink("default_key",
+					       sdata->debugfsdir, buf);
+	} else
+		ieee80211_debugfs_key_remove_default(sdata);
 }
+
 void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
 {
 	if (!sdata)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-02 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 23:04 [PATCH] mac80211: fix debugfs default key oops Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox