Module Name: src
Committed By: jakllsch
Date: Fri Jun 15 01:37:40 UTC 2018
Modified Files:
src/sys/dev/pci: virtio.c
Log Message:
Fix queue address setup bug introduced in 1.31.
This use-before-initialization problem resulted in non-zero queues never
being initialized with their virtqueue pointer, and queue zero's pointer
to be clobbered with the virtqueue pointer for the higest-indexed ring.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/dev/pci/virtio.c:1.34
--- src/sys/dev/pci/virtio.c:1.33 Wed Jun 6 17:17:31 2018
+++ src/sys/dev/pci/virtio.c Fri Jun 15 01:37:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio.c,v 1.33 2018/06/06 17:17:31 jakllsch Exp $ */
+/* $NetBSD: virtio.c,v 1.34 2018/06/15 01:37:40 jakllsch Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.33 2018/06/06 17:17:31 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.34 2018/06/15 01:37:40 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -404,7 +404,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
}
/* set the vq address */
- sc->sc_ops->setup_queue(sc, vq->vq_index,
+ sc->sc_ops->setup_queue(sc, index,
vq->vq_dmamap->dm_segs[0].ds_addr / VIRTIO_PAGE_SIZE);
/* remember addresses and offsets for later use */
@@ -449,7 +449,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
return 0;
err:
- sc->sc_ops->setup_queue(sc, vq->vq_index, 0);
+ sc->sc_ops->setup_queue(sc, index, 0);
if (vq->vq_dmamap)
bus_dmamap_destroy(sc->sc_dmat, vq->vq_dmamap);
if (vq->vq_vaddr)