From: James Morris Subject: Re: [PATCH 1/7] KEYS: encrypted: fix dereference of NULL user_key_payload Date: Tue, 3 Oct 2017 21:51:06 +1100 (AEDT) Message-ID: References: <20170928212602.41744-1-ebiggers3@gmail.com> <20170928212602.41744-2-ebiggers3@gmail.com> Mime-Version: 1.0 Return-path: In-Reply-To: <20170928212602.41744-2-ebiggers3@gmail.com> Sender: stable-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Eric Biggers Cc: keyrings@vger.kernel.org, David Howells , Michael Halcrow , linux-cachefs@redhat.com, ecryptfs@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-security-module@vger.kernel.org, Eric Biggers , stable@vger.kernel.org On Thu, 28 Sep 2017, Eric Biggers wrote: > From: Eric Biggers > > A key of type "encrypted" references a "master key" which is used to > encrypt and decrypt the encrypted key's payload. However, when we > accessed the master key's payload, we failed to handle the case where > the master key has been revoked, which sets the payload pointer to NULL. > Note that request_key() *does* skip revoked keys, but there is still a > window where the key can be revoked before we acquire its semaphore. > > Fix it by checking for a NULL payload, treating it like a key which was > already revoked at the time it was requested. > > This was an issue for master keys of type "user" only. Master keys can > also be of type "trusted", but those cannot be revoked. > > Fixes: 7e70cb497850 ("keys: add new key-type encrypted") > Cc: [v2.6.38+] > Signed-off-by: Eric Biggers Reviewed-by: James Morris -- James Morris