virtio: decrement vq->inuse in virtqueue_discard()
commit58a83c61496eeb0d31571a07a51bc1947e3379ac
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 15 Aug 2016 12:54:16 +0000 (15 13:54 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 23 Aug 2016 16:20:24 +0000 (23 19:20 +0300)
treeed98b38e087ad78bc1dad8162a75457c501b346f
parentbccdef6b1a204db0f41ffb6e24ce373e4d7890d4
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>
hw/virtio/virtio.c