X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=security%2Fkeys%2Fgc.c;h=b67f6a2a283802cde9f9cbf720f873f2fb5d7fa1;hp=bf4d8da5a79502f626a849473e4af18e229eb074;hb=206659fcb63b2ba078a0c288e470ea12cacce316;hpb=83f89ca755c9f783b8229d968c4e9d2c660ca427 diff --git a/security/keys/gc.c b/security/keys/gc.c index bf4d8da5a795..b67f6a2a2838 100644 --- a/security/keys/gc.c +++ b/security/keys/gc.c @@ -46,7 +46,7 @@ static unsigned long key_gc_flags; * immediately unlinked. */ struct key_type key_type_dead = { - .name = "dead", + .name = ".dead", }; /* @@ -172,6 +172,12 @@ static noinline void key_gc_unused_key(struct key *key) { key_check(key); + /* Throw away the key data if the key is instantiated */ + if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) && + !test_bit(KEY_FLAG_NEGATIVE, &key->flags) && + key->type->destroy) + key->type->destroy(key); + security_key_free(key); /* deal with the user's key tracking and quota */ @@ -188,10 +194,6 @@ static noinline void key_gc_unused_key(struct key *key) key_user_put(key->user); - /* now throw away the key memory */ - if (key->type->destroy) - key->type->destroy(key); - kfree(key->description); #ifdef KEY_DEBUGGING