From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYK3U-0006Rm-M2 for qemu-devel@nongnu.org; Fri, 12 Aug 2016 17:31:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYK3Q-0003Um-Dx for qemu-devel@nongnu.org; Fri, 12 Aug 2016 17:31:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYK3Q-0003Ui-8j for qemu-devel@nongnu.org; Fri, 12 Aug 2016 17:31:48 -0400 Date: Sat, 13 Aug 2016 00:31:44 +0300 From: "Michael S. Tsirkin" Message-ID: <20160813003122-mutt-send-email-mst@kernel.org> References: <1471015978-1123-1-git-send-email-stefanha@redhat.com> <1471015978-1123-3-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471015978-1123-3-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.7 2/4] virtio: decrement vq->inuse in virtqueue_discard() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Luiz Capitulino , gaudenz@debian.org On Fri, Aug 12, 2016 at 04:32:56PM +0100, Stefan Hajnoczi wrote: > virtqueue_descard() 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 With the correction above Reviewed-by: Michael S. Tsirkin > --- > hw/virtio/virtio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 4df8274..00158b6 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