Module Name: src
Committed By: riastradh
Date: Mon Aug 5 19:26:43 UTC 2024
Modified Files:
src/sys/dev/pci: virtio.c
Log Message:
virtio(4): Assert child attach finished before we allow queueing.
Should help catch mistakes like:
PR kern/58555: Kernel panic during boot when using viocon with PCIe
To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/virtio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.81 src/sys/dev/pci/virtio.c:1.82
--- src/sys/dev/pci/virtio.c:1.81 Sat Feb 10 02:25:15 2024
+++ src/sys/dev/pci/virtio.c Mon Aug 5 19:26:43 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio.c,v 1.81 2024/02/10 02:25:15 isaki Exp $ */
+/* $NetBSD: virtio.c,v 1.82 2024/08/05 19:26:43 riastradh Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.81 2024/02/10 02:25:15 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.82 2024/08/05 19:26:43 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1047,6 +1047,7 @@ virtio_enqueue_prep(struct virtio_softc
{
uint16_t slot;
+ KASSERT(sc->sc_child_state == VIRTIO_CHILD_ATTACH_FINISHED);
KASSERT(slotp != NULL);
slot = vq_alloc_slot(sc, vq, 1);