diff options
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r-- | net/mac80211/key.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 92d994f090b6..843d1577f00f 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -21,23 +21,16 @@ struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata, | |||
21 | key = kzalloc(sizeof(struct ieee80211_key) + key_len, flags); | 21 | key = kzalloc(sizeof(struct ieee80211_key) + key_len, flags); |
22 | if (!key) | 22 | if (!key) |
23 | return NULL; | 23 | return NULL; |
24 | kref_init(&key->kref); | ||
25 | return key; | 24 | return key; |
26 | } | 25 | } |
27 | 26 | ||
28 | static void ieee80211_key_release(struct kref *kref) | 27 | void ieee80211_key_free(struct ieee80211_key *key) |
29 | { | 28 | { |
30 | struct ieee80211_key *key; | 29 | if (!key) |
30 | return; | ||
31 | 31 | ||
32 | key = container_of(kref, struct ieee80211_key, kref); | ||
33 | if (key->conf.alg == ALG_CCMP) | 32 | if (key->conf.alg == ALG_CCMP) |
34 | ieee80211_aes_key_free(key->u.ccmp.tfm); | 33 | ieee80211_aes_key_free(key->u.ccmp.tfm); |
35 | ieee80211_debugfs_key_remove(key); | 34 | ieee80211_debugfs_key_remove(key); |
36 | kfree(key); | 35 | kfree(key); |
37 | } | 36 | } |
38 | |||
39 | void ieee80211_key_free(struct ieee80211_key *key) | ||
40 | { | ||
41 | if (key) | ||
42 | kref_put(&key->kref, ieee80211_key_release); | ||
43 | } | ||