From: David Howells Date: Wed, 2 Sep 2009 08:13:55 +0000 (+0100) Subject: KEYS: Flag dead keys to induce EKEYREVOKED [try #6] X-Git-Tag: firefly_0821_release~13017^2^2~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f041ae2f99d49adc914153a34a2d0e14e4389d90;p=firefly-linux-kernel-4.4.55.git KEYS: Flag dead keys to induce EKEYREVOKED [try #6] Set the KEY_FLAG_DEAD flag on keys for which the type has been removed. This causes the key_permission() function to return EKEYREVOKED in response to various commands. It does not, however, prevent unlinking or clearing of keyrings from detaching the key. Signed-off-by: David Howells Acked-by: Serge Hallyn Signed-off-by: James Morris --- diff --git a/security/keys/key.c b/security/keys/key.c index 3762d5b1ce64..bd9d2670e9c4 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -956,8 +956,10 @@ void unregister_key_type(struct key_type *ktype) for (_n = rb_first(&key_serial_tree); _n; _n = rb_next(_n)) { key = rb_entry(_n, struct key, serial_node); - if (key->type == ktype) + if (key->type == ktype) { key->type = &key_type_dead; + set_bit(KEY_FLAG_DEAD, &key->flags); + } } spin_unlock(&key_serial_lock);