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 150d66dbda9d..220e83be3ef4 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -380,6 +380,15 @@ void ieee80211_key_free(struct ieee80211_key *key) | |||
380 | if (!key) | 380 | if (!key) |
381 | return; | 381 | return; |
382 | 382 | ||
383 | if (!key->sdata) { | ||
384 | /* The key has not been linked yet, simply free it | ||
385 | * and don't Oops */ | ||
386 | if (key->conf.alg == ALG_CCMP) | ||
387 | ieee80211_aes_key_free(key->u.ccmp.tfm); | ||
388 | kfree(key); | ||
389 | return; | ||
390 | } | ||
391 | |||
383 | spin_lock_irqsave(&key->sdata->local->key_lock, flags); | 392 | spin_lock_irqsave(&key->sdata->local->key_lock, flags); |
384 | __ieee80211_key_free(key); | 393 | __ieee80211_key_free(key); |
385 | spin_unlock_irqrestore(&key->sdata->local->key_lock, flags); | 394 | spin_unlock_irqrestore(&key->sdata->local->key_lock, flags); |