From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 23 Feb 2018 13:47:26 +0100 From: Cornelia Huck To: Tiwei Bie Cc: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andy Lutomirski Subject: Re: [PATCH] virtio_ring: fix num_free handling in error case Message-ID: <20180223134726.3db96065.cohuck@redhat.com> In-Reply-To: <20180223114130.16332-1-tiwei.bie@intel.com> References: <20180223114130.16332-1-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: On Fri, 23 Feb 2018 19:41:30 +0800 Tiwei Bie wrote: > The vq->vq.num_free hasn't been changed when error happens, > so it shouldn't be changed when handling the error. > > Fixes: 780bc7903a32 ("virtio_ring: Support DMA APIs") > Cc: Andy Lutomirski > Cc: Michael S. Tsirkin > Cc: stable@vger.kernel.org > Signed-off-by: Tiwei Bie > --- > drivers/virtio/virtio_ring.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index eb30f3e09a47..71458f493cf8 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -428,8 +428,6 @@ static inline int virtqueue_add(struct virtqueue *_vq, > i = virtio16_to_cpu(_vq->vdev, vq->vring.desc[i].next); > } > > - vq->vq.num_free += total_sg; > - > if (indirect) > kfree(desc); > Reviewed-by: Cornelia Huck