]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86: nSVM: leave nested mode on vCPU free
authorMaxim Levitsky <mlevitsk@redhat.com>
Thu, 3 Nov 2022 14:13:43 +0000 (16:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:40:04 +0000 (17:40 +0100)
commit 917401f26a6af5756d89b550a8e1bd50cf42b07e upstream.

If the VM was terminated while nested, we free the nested state
while the vCPU still is in nested mode.

Soon a warning will be added for this condition.

Cc: stable@vger.kernel.org
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20221103141351.50662-2-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/svm.c

index 2b7528821577c13b3695a8f187e2ac9dc9cffac9..8f78cd8bfe92694e1aa4716083d22e7c28593c07 100644 (file)
@@ -1357,6 +1357,7 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu)
         */
        svm_clear_current_vmcb(svm->vmcb);
 
+       svm_leave_nested(vcpu);
        svm_free_nested(svm);
 
        __free_page(pfn_to_page(__sme_clr(svm->vmcb_pa) >> PAGE_SHIFT));