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


Groups > linux.kernel > #1735104

[PATCH] KEYS: key refcounting cleanup in keyctl_read_key

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Vasily Averin <vvs@virtuozzo.com>
Newsgroups linux.kernel
Subject [PATCH] KEYS: key refcounting cleanup in keyctl_read_key
Date Tue, 19 Sep 2017 19:00:01 +0200
Message-ID <uru2l-7SS-5@gated-at.bofh.it> (permalink)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Language en-US
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 24
Organization linux.* mail to news gateway
X-Original-Cc David Howells <dhowells@redhat.com>, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, James Morris <james.l.morris@oracle.com>, "Serge E. Hallyn" <serge@hallyn.com>, Konstantin Khorenko <khorenko@virtuozzo.com>
X-Original-Date Tue, 19 Sep 2017 19:51:08 +0300
X-Original-Message-ID <065a1f03-a342-c47c-ea6f-b4cc84f869bb@virtuozzo.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1735104

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[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

csiph-web