Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735104 > unrolled thread

[PATCH] KEYS: key refcounting cleanup in keyctl_read_key

Started byVasily Averin <vvs@virtuozzo.com>
First post2017-09-19 19:00 +0200
Last post2017-09-25 17:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] KEYS: key refcounting cleanup in keyctl_read_key Vasily Averin <vvs@virtuozzo.com> - 2017-09-19 19:00 +0200
    Re: [PATCH] KEYS: key refcounting cleanup in keyctl_read_key David Howells <dhowells@redhat.com> - 2017-09-25 17:30 +0200

#1735104 — [PATCH] KEYS: key refcounting cleanup in keyctl_read_key

FromVasily Averin <vvs@virtuozzo.com>
Date2017-09-19 19:00 +0200
Subject[PATCH] KEYS: key refcounting cleanup in keyctl_read_key
Message-ID<uru2l-7SS-5@gated-at.bofh.it>
key_put is lost if key_permission() returns non-EACCES error

Fixes: 29db919063406 ("Keys: Add LSM hooks for key management [try #3]")
Reported-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 security/keys/keyctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index ab0b337..70efb2d 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -771,7 +771,7 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
 	if (ret == 0)
 		goto can_read_key;
 	if (ret != -EACCES)
-		goto error;
+		goto error2;
 
 	/* we can't; see if it's searchable from this process's keyrings
 	 * - we automatically take account of the fact that it may be
-- 
2.7.4

[toc] | [next] | [standalone]


#1739121

FromDavid Howells <dhowells@redhat.com>
Date2017-09-25 17:30 +0200
Message-ID<utDuA-8b2-25@gated-at.bofh.it>
In reply to#1735104
I have a patch from Eric Biggers that does the same thing that I've applied.

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=keys-fixes&id=7fc0786d956d9e59b68d282be9b156179846ea3d

David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web