Received: by 10.223.185.116 with SMTP id b49csp653079wrg; Fri, 23 Feb 2018 04:48:29 -0800 (PST) X-Google-Smtp-Source: AH8x226QUfaxZ42LJ+LQ6iO6k6lLoD0Cy5NTNBYlK4cOMk7VQcIkj107yMQ1Vu+4tqn9X4ZEnSxQ X-Received: by 2002:a17:902:6b82:: with SMTP id p2-v6mr1675340plk.30.1519390109205; Fri, 23 Feb 2018 04:48:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519390109; cv=none; d=google.com; s=arc-20160816; b=V6t+DQhL++4aB4n/8hK1FCQyUVceJHrOslNkBLpmV0sMYnu3zvXBpw5yhcI3ytt4EP 6yvnbTDhiyLkoWLouE9mLmairVsYPZKQbaDGoc9LS5xQjBnimuK+fdZrH4D2gyBQMSav 6+erlbeFyT+n8K9sWns5GsG/WU29kdr2HuOjG5B3JLIlNEy4K0o22UrS/HSpL6Llu55M MmH0T9NjzRoQO0c0/+/cloAYQh+2cUzSPoidMC5TbopzMIvO93Xn9BTRvFo0oUAyf3TV xatN7dpDFwygYGUEie0FH7OAU4/Oy04Gj5w1VIAxEFPKL2wefZQc42777ctvFagCfTYH wzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=h/wA687ZOF0MsuyDZFtSK0kVGGDpyWBRIiVqmuzUN3o=; b=u7D+oRBwDwJC0dfb3hrrfpeYRFv0aRxDR8b0m8/kizp4lYg/AiWysJMvz5CGV3p4Sm 4LJtspPGalgQOmaRfyVIGxUvZzMTUBlVxbflJemr4Jpv03E1oUZD4I5rlyQUVBuwDOeU PbC6H58394n2xcyrjzY9+iyMpKUCsX0D/vQmVejcs9EpRFt0FyNYOLgetGES7Jl5LjKY L4GpLUUj8om8TDEnvO0NJIUZQ1QxNwz3KRvVi8XKSP/TbD9Hqgq5ISQeleEl/O1uV1+9 WoHt1+duze4MDVVMC19+mPUmb+goz/TEmuaNXap2ZWXXddWjz2qfLuYCnYTOvqn6Sf7W tfpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17-v6si1804184plj.334.2018.02.23.04.48.15; Fri, 23 Feb 2018 04:48:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751457AbeBWMre (ORCPT + 99 others); Fri, 23 Feb 2018 07:47:34 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48996 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750805AbeBWMrc (ORCPT ); Fri, 23 Feb 2018 07:47:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A30EE40201A0; Fri, 23 Feb 2018 12:47:31 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACC42AFD46; Fri, 23 Feb 2018 12:47:28 +0000 (UTC) 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> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Feb 2018 12:47:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Feb 2018 12:47:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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