Skip to content

Commit cb14e45

Browse files
committed
KVM: nVMX: Suppress external interrupt VM-Exit injection if there's no IRQ
In the should-be-impossible scenario that kvm_cpu_get_interrupt() doesn't return a valid vector after checking kvm_cpu_has_interrupt(), skip VM-Exit injection to reduce the probability of crashing/confusing L1. Now that KVM gets the IRQ _before_ calling nested_vmx_vmexit(), squashing the VM-Exit injection is trivial since there are no actions that need to be undone. Cc: stable@vger.kernel.org Reviewed-by: Chao Gao <chao.gao@intel.com> Link: https://lore.kernel.org/r/20240720000138.3027780-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 6f373f4 commit cb14e45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4296,7 +4296,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
42964296
int irq;
42974297

42984298
irq = kvm_cpu_get_interrupt(vcpu);
4299-
WARN_ON_ONCE(irq < 0);
4299+
if (WARN_ON_ONCE(irq < 0))
4300+
goto no_vmexit;
43004301

43014302
exit_intr_info = INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR | irq;
43024303
} else {

0 commit comments

Comments
 (0)