Re: [PATCH 2/6] KEYS: Allow keyctl_revoke() on keys that haveSETATTR but not WRITE perm

From: Serge E. Hallyn
Date: Tue Aug 04 2009 - 11:34:35 EST


Quoting David Howells (dhowells@xxxxxxxxxx):
> Allow keyctl_revoke() to operate on keys that have SETATTR but not WRITE
> permission, rather than only on keys that have WRITE permission.
>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>

Code seems to match the comment, and I see no docs saying this (SETATTR
implies revoke) shouldn't be the case, so I guess that call is purely
up to you :)

Acked-by: Serge Hallyn <serue@xxxxxxxxxx>

> ---
>
> security/keys/keyctl.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
>
> diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
> index b85ace2..1160b64 100644
> --- a/security/keys/keyctl.c
> +++ b/security/keys/keyctl.c
> @@ -343,7 +343,13 @@ long keyctl_revoke_key(key_serial_t id)
> key_ref = lookup_user_key(id, 0, KEY_WRITE);
> if (IS_ERR(key_ref)) {
> ret = PTR_ERR(key_ref);
> - goto error;
> + if (ret != -EACCES)
> + goto error;
> + key_ref = lookup_user_key(id, 0, KEY_SETATTR);
> + if (IS_ERR(key_ref)) {
> + ret = PTR_ERR(key_ref);
> + goto error;
> + }
> }
>
> key_revoke(key_ref_to_ptr(key_ref));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/