Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix queue address setup bug introduced in 1.31.



details:   https://anonhg.NetBSD.org/src/rev/b7e6fc966165
branches:  trunk
changeset: 319895:b7e6fc966165
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Jun 15 01:37:40 2018 +0000

description:
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.

diffstat:

 sys/dev/pci/virtio.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 5f676bf8a30d -r b7e6fc966165 sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Thu Jun 14 22:04:28 2018 +0000
+++ b/sys/dev/pci/virtio.c      Fri Jun 15 01:37:40 2018 +0000
@@ -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 @@
        }
 
        /* 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 @@
        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)



Home | Main Index | Thread Index | Old Index