From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753898AbdDCPwR (ORCPT ); Mon, 3 Apr 2017 11:52:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53346 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753419AbdDCPwP (ORCPT ); Mon, 3 Apr 2017 11:52:15 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B23DD8046A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B23DD8046A Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20170401233908.20786-1-ebiggers3@gmail.com> References: <20170401233908.20786-1-ebiggers3@gmail.com> To: Eric Biggers Cc: dhowells@redhat.com, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers , stable@vger.kernel.org Subject: Re: [PATCH] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3784.1491234722.1@warthog.procyon.org.uk> Date: Mon, 03 Apr 2017 16:52:02 +0100 Message-ID: <3785.1491234722@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 03 Apr 2017 15:52:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Biggers wrote: > @@ -135,6 +135,9 @@ int install_thread_keyring_to_cred(struct cred *new) > { > struct key *keyring; > > + if (new->thread_keyring) > + return -EEXIST; > + > keyring = keyring_alloc("_tid", new->uid, new->gid, new, > KEY_POS_ALL | KEY_USR_VIEW, > KEY_ALLOC_QUOTA_OVERRUN, It would probably be better just to return 0 and change the comment on the function to say that it sets a thread keyring if there isn't one already. Same for the process keyring. David