From a1ca7a12ff70e85a1749c179d38c10ec3cb52b4f Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Fri, 22 Dec 2017 11:15:53 +0100 Subject: [PATCH] virtio: fix enqueuing zero-length descriptor chains Previous descriptor chain was being corrupted by setting invalid vq->req_end (virtio.c:538). Change-Id: I4b27db02dc990e6af011a1b614e30e3050379e9f Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/392774 Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker --- lib/virtio/virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/virtio/virtio.c b/lib/virtio/virtio.c index 15a954f99..6906e40c7 100644 --- a/lib/virtio/virtio.c +++ b/lib/virtio/virtio.c @@ -511,7 +511,8 @@ virtqueue_req_add_iovs(struct virtqueue *vq, struct iovec *iovs, uint16_t iovcnt * or the caller specifies SPDK_VIRTIO_DESC_F_INDIRECT */ - prev_head = new_head = vq->vq_desc_head_idx; + prev_head = vq->req_end; + new_head = vq->vq_desc_head_idx; for (i = 0; i < iovcnt; ++i) { desc = &vq->vq_ring.desc[new_head];