]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86: Reset IRTE to host control if *new* route isn't postable
authorSean Christopherson <seanjc@google.com>
Fri, 4 Apr 2025 19:38:17 +0000 (12:38 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 24 Apr 2025 13:52:31 +0000 (09:52 -0400)
commit9bcac97dc42d2f4da8229d18feb0fe2b1ce523a2
tree9daad67ecaeb1e2ca1a4d04083d24cbe4d2f03be
parent7537deda36521fa8fff9133b39c46e31893606f2
KVM: x86: Reset IRTE to host control if *new* route isn't postable

Restore an IRTE back to host control (remapped or posted MSI mode) if the
*new* GSI route prevents posting the IRQ directly to a vCPU, regardless of
the GSI routing type.  Updating the IRTE if and only if the new GSI is an
MSI results in KVM leaving an IRTE posting to a vCPU.

The dangling IRTE can result in interrupts being incorrectly delivered to
the guest, and in the worst case scenario can result in use-after-free,
e.g. if the VM is torn down, but the underlying host IRQ isn't freed.

Fixes: efc644048ecd ("KVM: x86: Update IRTE for posted-interrupts")
Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20250404193923.1413163-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/avic.c
arch/x86/kvm/vmx/posted_intr.c