diff options
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r-- | net/mac80211/key.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 50d1cff23d8e..1b9d87ed143a 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -323,13 +323,15 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) | |||
323 | if (!key) | 323 | if (!key) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | ieee80211_key_disable_hw_accel(key); | 326 | if (key->local) |
327 | ieee80211_key_disable_hw_accel(key); | ||
327 | 328 | ||
328 | if (key->conf.alg == ALG_CCMP) | 329 | if (key->conf.alg == ALG_CCMP) |
329 | ieee80211_aes_key_free(key->u.ccmp.tfm); | 330 | ieee80211_aes_key_free(key->u.ccmp.tfm); |
330 | if (key->conf.alg == ALG_AES_CMAC) | 331 | if (key->conf.alg == ALG_AES_CMAC) |
331 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); | 332 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); |
332 | ieee80211_debugfs_key_remove(key); | 333 | if (key->local) |
334 | ieee80211_debugfs_key_remove(key); | ||
333 | 335 | ||
334 | kfree(key); | 336 | kfree(key); |
335 | } | 337 | } |
@@ -410,15 +412,12 @@ static void __ieee80211_key_free(struct ieee80211_key *key) | |||
410 | __ieee80211_key_destroy(key); | 412 | __ieee80211_key_destroy(key); |
411 | } | 413 | } |
412 | 414 | ||
413 | void ieee80211_key_free(struct ieee80211_key *key) | 415 | void ieee80211_key_free(struct ieee80211_local *local, |
416 | struct ieee80211_key *key) | ||
414 | { | 417 | { |
415 | struct ieee80211_local *local; | ||
416 | |||
417 | if (!key) | 418 | if (!key) |
418 | return; | 419 | return; |
419 | 420 | ||
420 | local = key->sdata->local; | ||
421 | |||
422 | mutex_lock(&local->key_mtx); | 421 | mutex_lock(&local->key_mtx); |
423 | __ieee80211_key_free(key); | 422 | __ieee80211_key_free(key); |
424 | mutex_unlock(&local->key_mtx); | 423 | mutex_unlock(&local->key_mtx); |