Module Name: src Committed By: uwe Date: Wed Apr 20 22:08:10 UTC 2022
Modified Files: src/sys/dev/pci: vio9p.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/vio9p.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/vio9p.c diff -u src/sys/dev/pci/vio9p.c:1.8 src/sys/dev/pci/vio9p.c:1.9 --- src/sys/dev/pci/vio9p.c:1.8 Wed Apr 13 15:24:42 2022 +++ src/sys/dev/pci/vio9p.c Wed Apr 20 22:08:10 2022 @@ -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 @@ vio9p_attach(device_t parent, device_t s 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,