KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:25 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/8dbfb2bf1bb3848a8069164e205635b2675c24fe
Commit:     8dbfb2bf1bb3848a8069164e205635b2675c24fe
Parent:     d2b9b2079e23c1ab80ce1d7670d5e1994468a881
Refname:    refs/heads/master
Author:     Eric Biggers <[email protected]>
AuthorDate: Wed Dec 20 16:24:27 2017 -0800
Committer:  Radim Krčmář <[email protected]>
CommitDate: Fri Feb 2 17:49:55 2018 +0100

    KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
    
    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 <[email protected]>
    Signed-off-by: Eric Biggers <[email protected]>
    Signed-off-by: Radim Krčmář <[email protected]>
---
 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 0e27ee573bd5..07d1c7f66d97 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7706,7 +7706,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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html