X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=security%2Fkeys%2Fuser_defined.c;h=7c687d568221cd71a3e863b9c9c50f5cd9352005;hb=414f827c46973ba39320cfb43feb55a0eeb9b4e8;hp=8e71895b97a7eaa90c4aee3088794d5b827a7cd6;hpb=0a0fc0ddbe732779366ab6b1b879f62195e65967;p=karo-tx-linux.git diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c index 8e71895b97a7..7c687d568221 100644 --- a/security/keys/user_defined.c +++ b/security/keys/user_defined.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -28,6 +27,7 @@ struct key_type key_type_user = { .instantiate = user_instantiate, .update = user_update, .match = user_match, + .revoke = user_revoke, .destroy = user_destroy, .describe = user_describe, .read = user_read, @@ -67,6 +67,7 @@ error: return ret; } /* end user_instantiate() */ + EXPORT_SYMBOL_GPL(user_instantiate); /*****************************************************************************/ @@ -141,7 +142,28 @@ EXPORT_SYMBOL_GPL(user_match); /*****************************************************************************/ /* - * dispose of the data dangling from the corpse of a user + * dispose of the links from a revoked keyring + * - called with the key sem write-locked + */ +void user_revoke(struct key *key) +{ + struct user_key_payload *upayload = key->payload.data; + + /* clear the quota */ + key_payload_reserve(key, 0); + + if (upayload) { + rcu_assign_pointer(key->payload.data, NULL); + call_rcu(&upayload->rcu, user_update_rcu_disposal); + } + +} /* end user_revoke() */ + +EXPORT_SYMBOL(user_revoke); + +/*****************************************************************************/ +/* + * dispose of the data dangling from the corpse of a user key */ void user_destroy(struct key *key) {