qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/6] hw/usb/hcd-xhci-pci: Don't trigger MSI on higher vector than


From: Phil Dennis-Jordan
Subject: [PATCH 1/6] hw/usb/hcd-xhci-pci: Don't trigger MSI on higher vector than allocated
Date: Sun, 8 Dec 2024 20:16:41 +0100

QEMU would crash with a failed assertion if the XHCI controller
attempted to raise the interrupt on a higher vector than the highest
configured for the device by the guest driver.

This change adds a check so the interrupt is dropped instead of crashing
the VM.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
 hw/usb/hcd-xhci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
index a039f5778a6..376635e889b 100644
--- a/hw/usb/hcd-xhci-pci.c
+++ b/hw/usb/hcd-xhci-pci.c
@@ -73,7 +73,7 @@ static bool xhci_pci_intr_raise(XHCIState *xhci, int n, bool 
level)
         return true;
     }
 
-    if (msi_enabled(pci_dev) && level) {
+    if (msi_enabled(pci_dev) && level && n < 
msi_nr_vectors_allocated(pci_dev)) {
         msi_notify(pci_dev, n);
         return true;
     }
-- 
2.39.5 (Apple Git-154)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]