public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Eric Biggers <ebiggers3@gmail.com>,
	kvm@vger.kernel.org
Cc: rkrcmar@redhat.com, christoffer.dall@linaro.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	Eric Biggers <ebiggers@google.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux-Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
Date: Thu, 21 Dec 2017 10:45:54 +0800	[thread overview]
Message-ID: <1bed30da-d01f-ecfd-8024-d7c402c30f15@intel.com> (raw)
In-Reply-To: <5e98adf7-809f-3b98-e8fc-6ba89e2777cf@redhat.com>

On 2017年12月21日 08:30, Paolo Bonzini wrote:
> On 21/12/2017 01:24, Eric Biggers wrote:
>> From: Eric Biggers <ebiggers@google.com>
>>
>> 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 <syzkaller@googlegroups.com>
>> Signed-off-by: Eric Biggers <ebiggers@google.com>
>> ---
>>  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

  parent reply	other threads:[~2017-12-21  2:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 16:03 KASAN: use-after-free Read in __schedule syzbot
2017-12-21  0:24 ` [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs() Eric Biggers
2017-12-21  0:30   ` Paolo Bonzini
2017-12-21  1:02     ` Stephen Rothwell
2017-12-21  2:45     ` Lan Tianyu [this message]
2017-12-21  9:07       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bed30da-d01f-ecfd-8024-d7c402c30f15@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=christoffer.dall@linaro.org \
    --cc=ebiggers3@gmail.com \
    --cc=ebiggers@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox