Received: by 10.213.65.68 with SMTP id h4csp468702imn; Tue, 13 Mar 2018 10:01:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELsjNHrrWb7S1kOZvkOCIE3GC1pxfh/6u46pEeGbcFZlNqPMm2FzN3op9vuyZ6ctITBzE91i X-Received: by 2002:a17:902:a607:: with SMTP id u7-v6mr1142341plq.367.1520960493265; Tue, 13 Mar 2018 10:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960493; cv=none; d=google.com; s=arc-20160816; b=KsuQFcaHQTlKeEc1Kfpr0tbsz7q2oicOBfXVy0vhoMeAZpOVsuDnqStomhENQB0BZj dLdZVecHMf00h8c8Q3fF0r+zlEvxvimoTH0PgfahQvlL1xkJsLIURX/aTDw36iHOpZJp aIyoD/5da0nhoRG9chaONYw3V5VRNRpSCNxW1xvkNyq+DhRhAe9ON5vovSfJkqB/pNVk qbVWpUaONf69XLvf8YJjlmKlZHeLv1YxpodDRy/JDPOe5sfJstAeUEESv/qD4j8iCi/a sN0MJN2wS7qGOPTlPlIRa1DHhUhA/bHzTBmUL0na0PW6fF24F9L+MXNAeEOentWTMDTI Y0tA== 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=tRkkHVmgO6KY/9xVGGxh0Q6LhihdAasCBmmof/EzqWs=; b=pT6rs6+1usyMYP9J5q6e14PBPwZo1xU/QsR4eFBK+ETv4Hq9TplkzopiOQNX2+MV2W tkOeKwstU+PEH4DMkEPoxgtYZqEqUpwa0PhgZ8ZwMzqKgbuaGBxIBva1pds3i0DnQLSU xsee3vAF8tfBECjPl9Tbgz7uQl66kcbp0xbws2t+ygpO0LGjP6ndHkmiBKMI1nrF3ulV e8suskrBOJmjGG/DB4WXspWosPA3k8l77iKea8yY+AwC1SXDBMg92hWccv+My8dOkZ28 ojcdY8L9ssdTC7Y8gt2vr/NGBJ6hEeWbaMbFPxTkTuwQ9lfNCIMQmL/9hwYBWjcwr7q4 Z/FA== 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 f64-v6si350014plb.377.2018.03.13.10.01.16; Tue, 13 Mar 2018 10:01:33 -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 S933190AbeCMQ7p (ORCPT + 99 others); Tue, 13 Mar 2018 12:59:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58552 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933076AbeCMP3u (ORCPT ); Tue, 13 Mar 2018 11:29:50 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E7D96FC6; Tue, 13 Mar 2018 15:29:49 +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.15 052/146] virtio_ring: fix num_free handling in error case Date: Tue, 13 Mar 2018 16:23:39 +0100 Message-Id: <20180313152324.669281046@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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 @@ -428,8 +428,6 @@ unmap_release: i = virtio16_to_cpu(_vq->vdev, vq->vring.desc[i].next); } - vq->vq.num_free += total_sg; - if (indirect) kfree(desc);