]> err.no Git - linux-2.6/blobdiff - net/mac80211/debugfs_key.c
[ARM] 5117/1: pxafb: fix __devinit/exit annotations
[linux-2.6] / net / mac80211 / debugfs_key.c
index 459f0767fae53e70b5e53076f21712057e6abb2a..19efc3a6a9327cfd343ab5e62de2a993ec6821bf 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <linux/kobject.h>
 #include "ieee80211_i.h"
-#include "ieee80211_key.h"
+#include "key.h"
 #include "debugfs.h"
 #include "debugfs_key.h"
 
@@ -195,6 +195,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
                return;
 
        sprintf(buf, "%d", keycount);
+       key->debugfs.cnt = keycount;
        keycount++;
        key->debugfs.dir = debugfs_create_dir(buf,
                                        key->local->debugfs.keys);
@@ -254,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->conf.keyidx);
-       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)