Received: by 10.213.65.68 with SMTP id h4csp463911imn; Fri, 16 Mar 2018 08:31:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELt1IGWZDN9r8TB0rDUN1//uaKIPC+wtKOfIc27sBRh/FiMWmWIz3fZPju6GKE48iS68qFHf X-Received: by 10.99.166.10 with SMTP id t10mr1794075pge.198.1521214307059; Fri, 16 Mar 2018 08:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214307; cv=none; d=google.com; s=arc-20160816; b=N7n4C4BuIJ44VQ6qb5YVjxedapoL67Oqm99weyN6qDw+eBCTGT+B0IFZa5RRSYVk4m NeBpSOyVnrKCgU13vZXKtCHkmeU6LZVAljPR0GzcM85+4IVNN56XUx2sB31t+gBr1cY2 sZUEBn3jmW8ViXHFJ4GhGfdbkmbXcX8Az+g9T+wWWKqCd2mU+wvtI54KIRMg9RbO8b9k 88kRtGWO6wEbnMx0WWsK/DDl2fb+vOvomxi2CWH0fg9i8xkf3NNuAbDBLSYFAjfroe5v BVyKJHbxOCuBwpyHEYS1jUCqsmIKX3ozsUq8YHe7N1FGz3nH1AleKmvOiwJVEIYIFFZz 1CmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=D49be6oPyNQRc4K3zKyAgm9DqBN0PyH1i6BDdVKFoU0=; b=Xf8/MpO6I+uI4sC3BODxGinmq8RCZrEeb2E3uJI89uDaHTujXZ94EZCNEsE6n/m7k+ phGVaqQ9qHpdXqnZ6OrZPO/Pn+dwt7OXWjBk601s6lM1g9JEmxIMUjXOaGBMhC3i0Y7T PBsQ6Ic/G9/djP91P8/l5F0XQYDYcoe8GuNi8fs0fBGVhbLVoftrv0vq43R768MKHs83 fD23A+pa/eW0JWUfDDZRdYHKkkXqNT6F6hbexH69PgSv/h68pz2iVRt3vsljO9v9Hxbt j5ecQfdNZoFNctcBWHKv0JgF07OLunw0DcSivBRlq6f8YOmUUwlBOwmk+rCfTpvel77B smHw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61-v6si6252771pld.692.2018.03.16.08.31.32; Fri, 16 Mar 2018 08:31:47 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933235AbeCPPaf (ORCPT + 99 others); Fri, 16 Mar 2018 11:30:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36548 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754334AbeCPPab (ORCPT ); Fri, 16 Mar 2018 11:30:31 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 36F611144; Fri, 16 Mar 2018 15:30:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , "Michael S. Tsirkin" , Tiwei Bie Subject: [PATCH 4.9 22/86] virtio_ring: fix num_free handling in error case Date: Fri, 16 Mar 2018 16:22:45 +0100 Message-Id: <20180316152318.866123947@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tiwei Bie commit e82df670235138575b37ff0ec24412a471efd97f upstream. 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 Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman --- drivers/virtio/virtio_ring.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -423,8 +423,6 @@ unmap_release: i = vq->vring.desc[i].next; } - vq->vq.num_free += total_sg; - if (indirect) kfree(desc);