diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-04-17 21:43:47 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-04-17 21:43:47 +0000 |
commit | 410427bbf6d5e78a55fb776a9aa3cfc0c5b2bc8c (patch) | |
tree | 6142cd590ad8760c356ebed9e5e2ad8e89d55d7b /sys/dev/pv | |
parent | 4669c9e47f4247a4845e1aaf4863ecb6e439ca1d (diff) |
Initialize virtqueue before passing it to device
Reported by Gary Zibrat
Diffstat (limited to 'sys/dev/pv')
-rw-r--r-- | sys/dev/pv/virtio.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index 3abbc072077..6115e523892 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.16 2019/03/24 18:22:36 sf Exp $ */ +/* $OpenBSD: virtio.c,v 1.17 2019/04/17 21:43:46 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -364,7 +364,6 @@ virtio_alloc_vq(struct virtio_softc *sc, struct virtqueue *vq, int index, } vq->vq_bytesize = allocsize; vq->vq_maxnsegs = maxnsegs; - virtio_setup_queue(sc, vq, vq->vq_dmamap->dm_segs[0].ds_addr); /* free slot management */ vq->vq_entries = mallocarray(vq_size, sizeof(struct vq_entry), @@ -375,6 +374,7 @@ virtio_alloc_vq(struct virtio_softc *sc, struct virtqueue *vq, int index, } virtio_init_vq(sc, vq, 0); + virtio_setup_queue(sc, vq, vq->vq_dmamap->dm_segs[0].ds_addr); #if VIRTIO_DEBUG printf("\nallocated %u byte for virtqueue %d for %s, size %d\n", @@ -386,7 +386,6 @@ virtio_alloc_vq(struct virtio_softc *sc, struct virtqueue *vq, int index, return 0; err: - virtio_setup_queue(sc, vq, 0); if (vq->vq_dmamap) bus_dmamap_destroy(sc->sc_dmat, vq->vq_dmamap); if (vq->vq_vaddr) |