From: David Howells Date: Thu, 1 Dec 2005 08:51:18 +0000 (-0800) Subject: [PATCH] Keys: Fix permissions check for update vs add X-Git-Tag: v2.6.15-rc5~52 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db1d1d57e97700b4131fe80556dc6ef976d534c4;p=linux-2.6 [PATCH] Keys: Fix permissions check for update vs add Permit add_key() to once again update a matching key rather than adding a new one if a matching key already exists in the target keyring. This bug causes add_key() to always add a new key, displacing the old from the target keyring. Signed-off-by: David Howells Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/keys/keyring.c b/security/keys/keyring.c index c7a0ab1cfd..4e9fa8be44 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c @@ -526,7 +526,7 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref, (!key->type->match || key->type->match(key, description)) && key_permission(make_key_ref(key, possessed), - perm) < 0 && + perm) == 0 && !test_bit(KEY_FLAG_REVOKED, &key->flags) ) goto found;