|
@@ -134,6 +134,10 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
|
|
|
kdebug("- %u", key->serial);
|
|
|
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 */
|
|
@@ -148,10 +152,6 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
|
|
|
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);
|