From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org ([103.22.144.67]:43019 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753393AbdJNBYF (ORCPT ); Fri, 13 Oct 2017 21:24:05 -0400 Date: Sat, 14 Oct 2017 12:23:37 +1100 From: Paul Mackerras To: Greg Kurz Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, David Gibson , Sam Bobroff , Paolo Bonzini , linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org Subject: Re: [PATCH] KVM: PPC: fix oops when checking KVM_CAP_PPC_HTM Message-ID: <20171014012337.GB26120@fergus.ozlabs.ibm.com> References: <150542618501.6859.11512107352972110416.stgit@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <150542618501.6859.11512107352972110416.stgit@bahia.lan> Sender: stable-owner@vger.kernel.org List-ID: On Thu, Sep 14, 2017 at 11:56:25PM +0200, Greg Kurz wrote: > The following program causes a kernel oops: > > #include > #include > #include > #include > #include > > main() > { > int fd = open("/dev/kvm", O_RDWR); > ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_PPC_HTM); > } > > This happens because when using the global KVM fd with > KVM_CHECK_EXTENSION, kvm_vm_ioctl_check_extension() gets > called with a NULL kvm argument, which gets dereferenced > in is_kvmppc_hv_enabled(). Spotted while reading the code. > > Let's use the hv_enabled fallback variable, like everywhere > else in this function. > > Fixes: 23528bb21ee2 ("KVM: PPC: Introduce KVM_CAP_PPC_HTM") > Cc: stable@vger.kernel.org # v4.7+ > Signed-off-by: Greg Kurz Thanks, applied to my kvm-ppc-fixes branch. Paul. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Date: Sat, 14 Oct 2017 01:23:37 +0000 Subject: Re: [PATCH] KVM: PPC: fix oops when checking KVM_CAP_PPC_HTM Message-Id: <20171014012337.GB26120@fergus.ozlabs.ibm.com> List-Id: References: <150542618501.6859.11512107352972110416.stgit@bahia.lan> In-Reply-To: <150542618501.6859.11512107352972110416.stgit@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg Kurz Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, David Gibson , Sam Bobroff , Paolo Bonzini , linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org On Thu, Sep 14, 2017 at 11:56:25PM +0200, Greg Kurz wrote: > The following program causes a kernel oops: > > #include > #include > #include > #include > #include > > main() > { > int fd = open("/dev/kvm", O_RDWR); > ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_PPC_HTM); > } > > This happens because when using the global KVM fd with > KVM_CHECK_EXTENSION, kvm_vm_ioctl_check_extension() gets > called with a NULL kvm argument, which gets dereferenced > in is_kvmppc_hv_enabled(). Spotted while reading the code. > > Let's use the hv_enabled fallback variable, like everywhere > else in this function. > > Fixes: 23528bb21ee2 ("KVM: PPC: Introduce KVM_CAP_PPC_HTM") > Cc: stable@vger.kernel.org # v4.7+ > Signed-off-by: Greg Kurz Thanks, applied to my kvm-ppc-fixes branch. Paul.