From: Jan Beulich Date: Mon, 31 Oct 2022 12:20:40 +0000 (+0100) Subject: VMX: correct error handling in vmx_create_vmcs() X-Git-Tag: archive/raspbian/4.16.2+90-g0d39a6d1ae-1+rpi1^2~28^2~60 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=02ab5e97c41d275ccea0910b1d8bce41ed1be5bf;p=xen.git VMX: correct error handling in vmx_create_vmcs() With the addition of vmx_add_msr() calls to construct_vmcs() there are now cases where simply freeing the VMCS isn't enough: The MSR bitmap page as well as one of the MSR area ones (if it's the 2nd vmx_add_msr() which fails) may also need freeing. Switch to using vmx_destroy_vmcs() instead. Fixes: 3bd36952dab6 ("x86/spec-ctrl: Introduce an option to control L1D_FLUSH for HVM HAP guests") Fixes: 53a570b28569 ("x86/spec-ctrl: Support IBPB-on-entry") Reported-by: Andrew Cooper Signed-off-by: Jan Beulich Reviewed-by: Kevin Tian master commit: 448d28309f1a966bdc850aff1a637e0b79a03e43 master date: 2022-10-12 17:57:56 +0200 --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index dd817cee4e..237b13459d 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1831,7 +1831,7 @@ int vmx_create_vmcs(struct vcpu *v) if ( (rc = construct_vmcs(v)) != 0 ) { - vmx_free_vmcs(vmx->vmcs_pa); + vmx_destroy_vmcs(v); return rc; }