Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/e8ab7b1e4c0f
branches:  netbsd-8
changeset: 938919:e8ab7b1e4c0f
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 20 10:14:20 2020 +0000

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

        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.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r b5dbc51053d7 -r e8ab7b1e4c0f sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Sat Sep 19 12:36:09 2020 +0000
+++ b/sys/dev/pci/virtio.c      Sun Sep 20 10:14:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $      */
+/*     $NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $   */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.2 2020/09/20 10:14:20 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -309,7 +309,7 @@
        }
 
        if (pci_intr_type(pc, sc->sc_ihp[0]) == PCI_INTR_TYPE_MSIX) {
-               sc->sc_ihs = kmem_alloc(sizeof(*sc->sc_ihs) * 2,
+               sc->sc_ihs = kmem_zalloc(sizeof(*sc->sc_ihs) * 2,
                    KM_SLEEP);
 
                error = virtio_setup_msix_interrupts(sc, &sc->sc_pa);
@@ -326,7 +326,7 @@
                sc->sc_ihs_num = 2;
                sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI;
        } else if (pci_intr_type(pc, sc->sc_ihp[0]) == PCI_INTR_TYPE_INTX) {
-               sc->sc_ihs = kmem_alloc(sizeof(*sc->sc_ihs) * 1,
+               sc->sc_ihs = kmem_zalloc(sizeof(*sc->sc_ihs) * 1,
                    KM_SLEEP);
 
                error = virtio_setup_intx_interrupt(sc, &sc->sc_pa);



Home | Main Index | Thread Index | Old Index