Commit 78520cad authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: fix debugfs default key oops

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d5251aea
...@@ -255,14 +255,23 @@ void ieee80211_debugfs_key_remove(struct ieee80211_key *key) ...@@ -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) void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
{ {
char buf[50]; char buf[50];
struct ieee80211_key *key;
if (!sdata->debugfsdir) if (!sdata->debugfsdir)
return; return;
sprintf(buf, "../keys/%d", sdata->default_key->debugfs.cnt); /* this is running under the key lock */
sdata->debugfs.default_key =
debugfs_create_symlink("default_key", sdata->debugfsdir, buf); 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) void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
{ {
if (!sdata) if (!sdata)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment