linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KEYS: key refcounting cleanup in keyctl_read_key
@ 2017-09-19 16:51 Vasily Averin
  2017-09-25 15:28 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Vasily Averin @ 2017-09-19 16:51 UTC (permalink / raw)
  To: linux-security-module

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

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] KEYS: key refcounting cleanup in keyctl_read_key
  2017-09-19 16:51 [PATCH] KEYS: key refcounting cleanup in keyctl_read_key Vasily Averin
@ 2017-09-25 15:28 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2017-09-25 15:28 UTC (permalink / raw)
  To: linux-security-module

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
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-25 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 16:51 [PATCH] KEYS: key refcounting cleanup in keyctl_read_key Vasily Averin
2017-09-25 15:28 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).