cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
619821
From bf7aa4bb11e9991a3d5a1007dbe52dd0ac6dae99 Mon Sep 17 00:00:00 2001
4f5da8
From: Ladi Prosek <lprosek@redhat.com>
4f5da8
Date: Wed, 5 Oct 2016 17:22:25 +0200
4f5da8
Subject: [PATCH 3/8] virtio: decrement vq->inuse in virtqueue_discard()
4f5da8
4f5da8
RH-Author: Ladi Prosek <lprosek@redhat.com>
4f5da8
Message-id: <1475666548-9186-4-git-send-email-lprosek@redhat.com>
4f5da8
Patchwork-id: 72482
4f5da8
O-Subject: [RHEL-7.4 qemu-kvm v2 PATCH 3/6] virtio: decrement vq->inuse in virtqueue_discard()
619821
Bugzilla: 1377968
4f5da8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4f5da8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
4f5da8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4f5da8
4f5da8
From: Stefan Hajnoczi <stefanha@redhat.com>
4f5da8
4f5da8
virtqueue_discard() moves vq->last_avail_idx back so the element can be
4f5da8
popped again.  It's necessary to decrement vq->inuse to avoid "leaking"
4f5da8
the element count.
4f5da8
4f5da8
Cc: qemu-stable@nongnu.org
4f5da8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4f5da8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4f5da8
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
4f5da8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4f5da8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
4f5da8
(cherry picked from commit 58a83c61496eeb0d31571a07a51bc1947e3379ac)
4f5da8
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
4f5da8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4f5da8
---
4f5da8
 hw/virtio/virtio.c | 1 +
4f5da8
 1 file changed, 1 insertion(+)
4f5da8
4f5da8
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
4f5da8
index 91c9642..87a7639 100644
4f5da8
--- a/hw/virtio/virtio.c
4f5da8
+++ b/hw/virtio/virtio.c
4f5da8
@@ -255,6 +255,7 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
4f5da8
                        unsigned int len)
4f5da8
 {
4f5da8
     vq->last_avail_idx--;
4f5da8
+    vq->inuse--;
4f5da8
     virtqueue_unmap_sg(vq, elem, len);
4f5da8
 }
4f5da8
 
4f5da8
-- 
4f5da8
1.8.3.1
4f5da8