From: Sean Christopherson Date: Mon, 3 Dec 2018 21:52:51 +0000 (-0800) Subject: KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails X-Git-Tag: v4.19.14~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9dae887cf649f68d053bb0a8cb87f748789c881;p=platform%2Fkernel%2Flinux-rpi3.git KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails commit 1b3ab5ad1b8ad99bae76ec583809c5f5a31c707c upstream. 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 Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 33ffb6d..8417400 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -8011,13 +8011,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)