Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314AbdDCTUt (ORCPT ); Mon, 3 Apr 2017 15:20:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45196 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbdDCTUr (ORCPT ); Mon, 3 Apr 2017 15:20:47 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 42DE46540A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 42DE46540A 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: <20170403175929.GB72831@gmail.com> References: <20170403175929.GB72831@gmail.com> <20170401213428.17097-1-ebiggers3@gmail.com> <3451.1491234402@warthog.procyon.org.uk> 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 dereferencing NULL payload with nonzero length MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6883.1491247244.1@warthog.procyon.org.uk> Date: Mon, 03 Apr 2017 20:20:44 +0100 Message-ID: <6884.1491247244@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 03 Apr 2017 19:20:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 460 Lines: 17 Eric Biggers wrote: > > > - if (_payload) { > > > + if (plen) { > > > > "if (_payload && plen)" would be better. > > > > David > > No, that doesn't solve the problem. The problem is that userspace can pass > in a NULL payload with nonzero length, causing the kernel to dereference a > NULL pointer for some key types. For example: Okay, in that case, I think there should be an else-statement that clears plen if !_payload. David