Received: from eggs.gnu.org ([2001:4830:134:3::10]:49493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZDCC-0004gC-J1 for qemu-devel@nongnu.org; Mon, 15 Aug 2016 04:24:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZDC8-0003ch-9D for qemu-devel@nongnu.org; Mon, 15 Aug 2016 04:24:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:9512 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZDC8-0003cb-3L for qemu-devel@nongnu.org; Mon, 15 Aug 2016 04:24:28 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7F8JOjM009442 for ; Mon, 15 Aug 2016 04:24:27 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 24tgu1n6s9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 15 Aug 2016 04:24:27 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 Aug 2016 09:24:26 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D385A2190023 for ; Mon, 15 Aug 2016 09:23:48 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7F8OOkB61735016 for ; Mon, 15 Aug 2016 08:24:24 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7F8ONiG005944 for ; Mon, 15 Aug 2016 02:24:24 -0600 Date: Mon, 15 Aug 2016 10:24:22 +0200 From: Cornelia Huck In-Reply-To: <1471015978-1123-3-git-send-email-stefanha@redhat.com> 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-Transfer-Encoding: 7bit Message-Id: <20160815102422.2fb627d3.cornelia.huck@de.ibm.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, gaudenz@debian.org, "Michael S. Tsirkin" , Luiz Capitulino On Fri, 12 Aug 2016 16:32:56 +0100 Stefan Hajnoczi wrote: > virtqueue_descard() 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 > --- > 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); > } > Reviewed-by: Cornelia Huck