KEYS: Deal with dead-type keys appropriately [try #6]

Allow keys for which the key type has been removed to be unlinked.  Currently
dead-type keys can only be disposed of by completely clearing the keyrings
that point to them.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
David Howells
2009-09-02 09:13:45 +01:00
committed by James Morris
parent e0e817392b
commit 5593122eec
4 changed files with 48 additions and 31 deletions

View File

@@ -642,10 +642,8 @@ struct key *key_lookup(key_serial_t id)
goto error;
found:
/* pretend it doesn't exist if it's dead */
if (atomic_read(&key->usage) == 0 ||
test_bit(KEY_FLAG_DEAD, &key->flags) ||
key->type == &key_type_dead)
/* pretend it doesn't exist if it is awaiting deletion */
if (atomic_read(&key->usage) == 0)
goto not_found;
/* this races with key_put(), but that doesn't matter since key_put()