summaryrefslogtreecommitdiff
path: root/security/keys/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/gc.c')
-rw-r--r--security/keys/gc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 2e2395d6bd16..207e9686c249 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -172,6 +172,10 @@ static noinline void key_gc_unused_key(struct key *key)
{
key_check(key);
+ /* Throw away the key data */
+ if (key->type->destroy)
+ key->type->destroy(key);
+
security_key_free(key);
/* deal with the user's key tracking and quota */
@@ -186,10 +190,6 @@ static noinline void key_gc_unused_key(struct key *key)
if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags))
atomic_dec(&key->user->nikeys);
- /* now throw away the key memory */
- if (key->type->destroy)
- key->type->destroy(key);
-
key_user_put(key->user);
kfree(key->description);