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)