diff mbox series

[v2,3/4] KVM: nSVM: always leave the nested state first on KVM_SET_NESTED_STATE

Message ID 20210107093854.882483-4-mlevitsk@redhat.com (mailing list archive)
State New, archived
Headers show
Series KVM: nSVM: few random fixes | expand

Commit Message

Maxim Levitsky Jan. 7, 2021, 9:38 a.m. UTC
This should prevent bad things from happening if the user calls the
KVM_SET_NESTED_STATE twice.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 arch/x86/kvm/svm/nested.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index cc3130ab612e5..e91d40c8d8c91 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -1200,6 +1200,7 @@  static int svm_set_nested_state(struct kvm_vcpu *vcpu,
 	 * in the registers, the save area of the nested state instead
 	 * contains saved L1 state.
 	 */
+	svm_leave_nested(svm);
 
 	svm->nested.nested_run_pending =
 		!!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING);