Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757530AbdLUC43 (ORCPT ); Wed, 20 Dec 2017 21:56:29 -0500 Received: from mga07.intel.com ([134.134.136.100]:52847 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756536AbdLUC40 (ORCPT ); Wed, 20 Dec 2017 21:56:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="13508272" Subject: Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs() To: Paolo Bonzini , Eric Biggers , kvm@vger.kernel.org References: <001a1148cc3acf967c0560c7b760@google.com> <20171221002427.82325-1-ebiggers3@gmail.com> <5e98adf7-809f-3b98-e8fc-6ba89e2777cf@redhat.com> Cc: rkrcmar@redhat.com, christoffer.dall@linaro.org, x86@kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Eric Biggers , Stephen Rothwell , Linux-Next Mailing List From: Lan Tianyu Message-ID: <1bed30da-d01f-ecfd-8024-d7c402c30f15@intel.com> Date: Thu, 21 Dec 2017 10:45:54 +0800 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5e98adf7-809f-3b98-e8fc-6ba89e2777cf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1406 Lines: 43 On 2017年12月21日 08:30, Paolo Bonzini wrote: > On 21/12/2017 01:24, Eric Biggers wrote: >> From: Eric Biggers >> >> Due to a bad merge resolution between commit f29810335965 ("KVM/x86: >> Check input paging mode when cs.l is set") and commit b4ef9d4e8cb8 >> ("KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs"), >> there is a case in kvm_arch_vcpu_ioctl_set_sregs() where vcpu_put() is >> not called after vcpu_get(). Fix it. >> >> Reported-by: syzbot >> Signed-off-by: Eric Biggers >> --- >> arch/x86/kvm/x86.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index ea3a98196753..f4e8b5089b28 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -7624,7 +7624,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, >> goto out; >> >> if (kvm_valid_sregs(vcpu, sregs)) >> - return -EINVAL; >> + goto out; >> >> apic_base_msr.data = sregs->apic_base; >> apic_base_msr.host_initiated = true; >> > > Thanks very much Eric, that was fast! Adding Stephen and the linux-next > mailing list to Cc. Adding the kvm/master tree has already paid off. > > Paolo > Hi Paolo: Should we check input sregs before loading vcpu? If input sregs is invalid, the operation is redundant. -- Best regards Tianyu Lan