diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-08-15 13:54:16 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-08-23 19:20:24 +0300 |
commit | 58a83c61496eeb0d31571a07a51bc1947e3379ac (patch) | |
tree | ed98b38e087ad78bc1dad8162a75457c501b346f | |
parent | bccdef6b1a204db0f41ffb6e24ce373e4d7890d4 (diff) |
virtio: decrement vq->inuse in virtqueue_discard()
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: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | hw/virtio/virtio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 6105c6eb62..74c085c74d 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -268,6 +268,7 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len) { vq->last_avail_idx--; + vq->inuse--; virtqueue_unmap_sg(vq, elem, len); } |