diff options
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r-- | net/mac80211/key.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index d4893bd17754..6597c779e35a 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -387,6 +387,15 @@ void ieee80211_key_free(struct ieee80211_key *key) | |||
387 | if (!key) | 387 | if (!key) |
388 | return; | 388 | return; |
389 | 389 | ||
390 | if (!key->sdata) { | ||
391 | /* The key has not been linked yet, simply free it | ||
392 | * and don't Oops */ | ||
393 | if (key->conf.alg == ALG_CCMP) | ||
394 | ieee80211_aes_key_free(key->u.ccmp.tfm); | ||
395 | kfree(key); | ||
396 | return; | ||
397 | } | ||
398 | |||
390 | spin_lock_irqsave(&key->sdata->local->key_lock, flags); | 399 | spin_lock_irqsave(&key->sdata->local->key_lock, flags); |
391 | __ieee80211_key_free(key); | 400 | __ieee80211_key_free(key); |
392 | spin_unlock_irqrestore(&key->sdata->local->key_lock, flags); | 401 | spin_unlock_irqrestore(&key->sdata->local->key_lock, flags); |