summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadi Prosek <lprosek@redhat.com>2016-09-07 17:20:47 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2016-09-14 20:50:31 -0500
commit44d28f22bcc687f75849c9fa07ce88c5d8cefa3b (patch)
tree966b72aef838c4d59b64d6efbf967d930fb1d97c
parent1af2c3fcb89969f0fc5e31d6e50561a770c9fa8a (diff)
downloadqemu-44d28f22bcc687f75849c9fa07ce88c5d8cefa3b.tar.gz
virtio-balloon: discard virtqueue element on reset
The one pending element is being freed but not discarded on device reset, which causes svq->inuse to creep up, eventually hitting the "Virtqueue size exceeded" error. Properly discarding the element on device reset makes sure that its buffers are unmapped and the inuse counter stays balanced. Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Roman Kagan <rkagan@virtuozzo.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 104e70cae78bd4afd95d948c6aff188f10508a9c) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--hw/virtio/virtio-balloon.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 9dbe681790..bffdab3847 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -478,6 +478,7 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev)
VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
if (s->stats_vq_elem != NULL) {
+ virtqueue_discard(s->svq, s->stats_vq_elem, 0);
g_free(s->stats_vq_elem);
s->stats_vq_elem = NULL;
}