diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d19bb602ff07..ccc9d75124a6 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -8159,15 +8159,16 @@ static int handle_vmon(struct kvm_vcpu *vcpu) */ static int nested_vmx_check_permission(struct kvm_vcpu *vcpu) { + if (!to_vmx(vcpu)->nested.vmxon) { + kvm_queue_exception(vcpu, UD_VECTOR); + return 0; + } + if (vmx_get_cpl(vcpu)) { kvm_inject_gp(vcpu, 0); return 0; } - if (!to_vmx(vcpu)->nested.vmxon) { - kvm_queue_exception(vcpu, UD_VECTOR); - return 0; - } return 1; }