Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci vio9p: avoid null pointer dereference on attach.



details:   https://anonhg.NetBSD.org/src/rev/19cdbdcbb341
branches:  trunk
changeset: 365721:19cdbdcbb341
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Apr 20 22:08:10 2022 +0000

description:
vio9p: avoid null pointer dereference on attach.

Pass "vqs" argument to virtio_child_attach_start().  The virtio API is
not quite clear to me here - there's also a separate setter
virtio_child_attach_set_vqs that performs some additional actions.

Queue setup for Virtio 1.0 accesses virtio_softc::sc_vqs and we didn't
set it.  QEMU exposes only the old virtio interface, so it doesn't
trigger the problem.

diffstat:

 sys/dev/pci/vio9p.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r c86ac07ba0ba -r 19cdbdcbb341 sys/dev/pci/vio9p.c
--- a/sys/dev/pci/vio9p.c       Wed Apr 20 19:06:35 2022 +0000
+++ b/sys/dev/pci/vio9p.c       Wed Apr 20 22:08:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vio9p.c,v 1.8 2022/04/13 15:24:42 uwe Exp $    */
+/*     $NetBSD: vio9p.c,v 1.9 2022/04/20 22:08:10 uwe Exp $    */
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.8 2022/04/13 15:24:42 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.9 2022/04/20 22:08:10 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -500,7 +500,7 @@
        sc->sc_dev = self;
        sc->sc_virtio = vsc;
 
-       virtio_child_attach_start(vsc, self, IPL_VM, NULL,
+       virtio_child_attach_start(vsc, self, IPL_VM, sc->sc_vq,
            NULL, virtio_vq_intr,
            VIRTIO_F_INTR_MPSAFE | VIRTIO_F_INTR_SOFTINT,
            VIO9P_F_MOUNT_TAG,



Home | Main Index | Thread Index | Old Index