diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1b8d1228c8fc..1eb06f79e61b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -11059,8 +11059,10 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, * which means L1 attempted VMEntry to L2 with invalid state. * Fail the VMEntry. */ - if (vmx->emulation_required) + if (vmx->emulation_required) { + *entry_failure_code = ENTRY_FAIL_DEFAULT; return 1; + } /* Shadow page tables on either EPT or shadow page tables. */ if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_cpu_has_ept(vmcs12),