]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mac80211: fix debugfs default key oops
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 2 May 2008 23:04:47 +0000 (01:04 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 13 May 2008 01:18:05 +0000 (21:18 -0400)
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/debugfs_key.c

index 879e7210458ad3ae8965b0d8cc7211cd614a83c2..19efc3a6a9327cfd343ab5e62de2a993ec6821bf 100644 (file)
@@ -255,14 +255,23 @@ void ieee80211_debugfs_key_remove(struct ieee80211_key *key)
 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)