From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] virtio: decrement vq->inuse in virtqueue_discard()
Date: Mon, 15 Aug 2016 13:54:16 +0100 [thread overview]
Message-ID: <1471265656-11227-3-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1471265656-11227-1-git-send-email-stefanha@redhat.com>
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.
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>
---
hw/virtio/virtio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6105c6e..74c085c 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);
}
--
2.7.4
next prev parent reply other threads:[~2016-08-15 12:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 12:54 [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
2016-08-15 12:54 ` [Qemu-devel] [PATCH 1/2] virtio: recalculate vq->inuse after migration Stefan Hajnoczi
2016-08-15 12:54 ` Stefan Hajnoczi [this message]
2016-08-17 13:58 ` [Qemu-devel] [PATCH 0/2] virtio: fix VirtQueue->inuse field Stefan Hajnoczi
2016-08-23 6:49 ` [Qemu-devel] [Qemu-stable] " Peter Lieven
2016-08-23 15:57 ` Stefan Hajnoczi
2016-08-22 14:00 ` [Qemu-devel] " Denis V. Lunev
2016-08-22 18:23 ` Denis V. Lunev
2016-08-30 19:54 ` Stefan Hajnoczi
2016-08-30 20:02 ` Denis V. Lunev
2016-08-31 9:25 ` Roman Kagan
2016-08-31 17:06 ` Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471265656-11227-3-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=famz@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).