Skip to content

Commit

Permalink
KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails
Browse files Browse the repository at this point in the history
Fixes: 34a1cd6 ("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>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Dec 14, 2018
1 parent 2a31b9d commit 1b3ab5a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b3ab5a

Please sign in to comment.