From: Maxim Levitsky <mlevitsk@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Message-Id: <20221103141351.50662-2-mlevitsk@xxxxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/svm/svm.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1427,6 +1427,7 @@ static void svm_free_vcpu(struct kvm_vcp */ svm_clear_current_vmcb(svm->vmcb); + svm_leave_nested(vcpu); svm_free_nested(svm); sev_free_vcpu(vcpu);