Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci Pull up following revision(s) (requested by j...



details:   https://anonhg.NetBSD.org/src/rev/f1775a6e6cc0
branches:  netbsd-9
changeset: 964127:f1775a6e6cc0
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 20 10:03:11 2020 +0000

description:
Pull up following revision(s) (requested by jakllsch in ticket #1089):

        sys/dev/pci/virtio_pci.c: revision 1.12

Ensure interrupt handles buffer is zeroed on allocation
Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me

diffstat:

 sys/dev/pci/virtio_pci.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 08a2f812c33d -r f1775a6e6cc0 sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c  Sat Sep 19 12:32:59 2020 +0000
+++ b/sys/dev/pci/virtio_pci.c  Sun Sep 20 10:03:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -697,7 +697,7 @@
        }
 
        if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_MSIX) {
-               psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * nmsix,
+               psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * nmsix,
                    KM_SLEEP);
 
                error = virtio_pci_setup_msix_interrupts(sc, &psc->sc_pa);
@@ -714,7 +714,7 @@
                psc->sc_ihs_num = nmsix;
                psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI;
        } else if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_INTX) {
-               psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * 1,
+               psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * 1,
                    KM_SLEEP);
 
                error = virtio_pci_setup_intx_interrupt(sc, &psc->sc_pa);



Home | Main Index | Thread Index | Old Index