summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorMaxim Levitsky <mlevitsk@redhat.com>2022-11-03 17:13:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-02 19:40:04 +0300
commit7e5cb13091e62b2ad2fe1d3a48753c7219a3e9f9 (patch)
treeaf91cba0b1a6284694eb0b460cea53ea0c26cc71 /arch/x86
parentd925dd3e444cb7f0fab0208fed82673fd61f9765 (diff)
downloadlinux-7e5cb13091e62b2ad2fe1d3a48753c7219a3e9f9.tar.xz
KVM: x86: nSVM: leave nested mode on vCPU free
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>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/svm/svm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 2b7528821577..8f78cd8bfe92 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -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));