qemu-stable
[Top][All Lists]
Advanced

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

[Qemu-stable] [PATCH 3/6] virtio: decrement vq->inuse in virtqueue_disca


From: Ladi Prosek
Subject: [Qemu-stable] [PATCH 3/6] virtio: decrement vq->inuse in virtqueue_discard()
Date: Mon, 2 Jan 2017 12:58:42 +0100

From: Stefan Hajnoczi <address@hidden>

virtqueue_discard() moves vq->last_avail_idx back so the element can be
popped again.  It's necessary to decrement vq->inuse to avoid "leaking"
the element count.

Cc: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
(cherry picked from commit 58a83c61496eeb0d31571a07a51bc1947e3379ac)
Signed-off-by: Ladi Prosek <address@hidden>
---
 hw/virtio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio.c b/hw/virtio.c
index 3af7a18..eb527d0 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -261,6 +261,7 @@ void virtqueue_discard(VirtQueue *vq, const 
VirtQueueElement *elem,
                        unsigned int len)
 {
     vq->last_avail_idx--;
+    vq->inuse--;
     virtqueue_unmap_sg(vq, elem, len);
 }
 
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]