From: patrick Date: Wed, 5 Jul 2023 18:11:08 +0000 (+0000) Subject: Fix off-by-one in the MSI-X interrupt establish loop that always tried to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=de3309eee246ab22f714794c6ed0d90cabe5acc6;p=openbsd Fix off-by-one in the MSI-X interrupt establish loop that always tried to establish one more interrupt than would be needed for per-VQ IRQs. This meant even though there were enough MSI-X vectors available this path could fail, roll back previously established interrupts and switch to shared IRQs as a fallback. ok dv@ --- diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c index 1e543983466..28087f1ac9d 100644 --- a/sys/dev/pci/virtio_pci.c +++ b/sys/dev/pci/virtio_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_pci.c,v 1.33 2023/05/29 08:13:35 sf Exp $ */ +/* $OpenBSD: virtio_pci.c,v 1.34 2023/07/05 18:11:08 patrick Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -976,7 +976,7 @@ virtio_pci_setup_msix(struct virtio_pci_softc *sc, struct pci_attach_args *pa, for (i = 0; i < vsc->sc_nvqs; i++) virtio_pci_set_msix_queue_vector(sc, i, 1); } else { - for (i = 0; i <= vsc->sc_nvqs; i++) { + for (i = 0; i < vsc->sc_nvqs; i++) { if (virtio_pci_msix_establish(sc, pa, i + 1, virtio_pci_queue_intr, &vsc->sc_vqs[i])) { goto fail;