KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 3 Dec 2018 21:52:51 +0000 (13:52 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Dec 2018 11:34:20 +0000 (12:34 +0100)
Fixes: 34a1cd60d17f ("kvm: x86: vmx: move some vmx setting from vmx_init() to hardware_setup()")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index c379d0bfdcba948651dbbebff284e87749b09455..3ec47b7a94d63e59eef51c37ec522db936b6624b 100644 (file)
@@ -8037,13 +8037,16 @@ static __init int hardware_setup(void)
 
        kvm_mce_cap_supported |= MCG_LMCE_P;
 
-       return alloc_kvm_area();
+       r = alloc_kvm_area();
+       if (r)
+               goto out;
+       return 0;
 
 out:
        for (i = 0; i < VMX_BITMAP_NR; i++)
                free_page((unsigned long)vmx_bitmap[i]);
 
-    return r;
+       return r;
 }
 
 static __exit void hardware_unsetup(void)