From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752239AbdB1MEA (ORCPT ); Tue, 28 Feb 2017 07:04:00 -0500 Received: from ozlabs.org ([103.22.144.67]:46619 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbdB1MDs (ORCPT ); Tue, 28 Feb 2017 07:03:48 -0500 Date: Tue, 28 Feb 2017 15:59:27 +1100 From: Paul Mackerras To: David Gibson Cc: dan.carpenter@oracle.com, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: Prevent double-free on HPT resize commit path Message-ID: <20170228045927.GB25371@fergus.ozlabs.ibm.com> References: <20170215034004.9255-1-david@gibson.dropbear.id.au> <20170228005655.GK17615@umbus.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170228005655.GK17615@umbus.fritz.box> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2017 at 11:56:55AM +1100, David Gibson wrote: > On Wed, Feb 15, 2017 at 02:40:04PM +1100, David Gibson wrote: > > resize_hpt_release(), called once the HPT resize of a KVM guest is > > completed (successfully or unsuccessfully) free()s the state structure for > > the resize. It is currently not safe to call with a NULL pointer. > > > > However, one of the error paths in kvm_vm_ioctl_resize_hpt_commit() can > > invoke it with a NULL pointer. This will occur if userspace improperly > > invokes KVM_PPC_RESIZE_HPT_COMMIT without previously calling > > KVM_PPC_RESIZE_HPT_PREPARE, or if it calls COMMIT twice without an > > intervening PREPARE. > > > > To fix this potential crash bug - and maybe others like it, make it safe > > (and a no-op) to call resize_hpt_release() with a NULL resize pointer. > > > > Found by Dan Carpenter with a static checker. > > > > Reported-by: Dan Carpenter > > Signed-off-by: David Gibson > > Ping, > > Paul have you taken this one? Yes, thanks, it's in Linus' tree now. Paul.