]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 18 Dec 2019 21:54:48 +0000 (13:54 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 May 2020 20:19:34 +0000 (21:19 +0100)
commit22725fee3d79718feccb5eee32beeb40583cc086
treeaa2ab876d0c12cc8b265b88b82448f2e3374a848
parent9c98c4926b6d5dbabfa3ee9df1083c88709aca8b
KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails

commit 16be9ddea268ad841457a59109963fff8c9de38d upstream.

Free the vCPU's wbinvd_dirty_mask if vCPU creation fails after
kvm_arch_vcpu_init(), e.g. when installing the vCPU's file descriptor.
Do the freeing by calling kvm_arch_vcpu_free() instead of open coding
the freeing.  This adds a likely superfluous, but ultimately harmless,
call to kvmclock_reset(), which only clears vcpu->arch.pv_time_enabled.
Using kvm_arch_vcpu_free() allows for additional cleanup in the future.

Fixes: f5f48ee15c2ee ("KVM: VMX: Execute WBINVD to keep data consistency with assigned devices")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[bwh: Backported to 3.16: Also delete the preceding fx_free(), since
 kvm_arch_vcpu_free() calls it.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kvm/x86.c