Received: by 10.213.65.68 with SMTP id h4csp433278imn; Tue, 13 Mar 2018 08:55:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELt60ViJQ3CfyumNSJ3ghCzCqPPJG7YUK3ytMXFI3TkDPf5jr0RD+/4bVh/EaeEWdI8/w4Al X-Received: by 2002:a17:902:b10c:: with SMTP id q12-v6mr1011779plr.197.1520956521784; Tue, 13 Mar 2018 08:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956521; cv=none; d=google.com; s=arc-20160816; b=p9XBlDc7ddgA5iPy/ouzJT2frKnmrpZ8YdSj5KrZidup4qKFOW9jKCDJhr/fljkJO4 AOPBaTGbBlnyNFAHoYG/FxYld14MxSCKwKu/kPY/4ObNtW8CLJaaynzTopceNG4RMgDw 33DOxfpm42EZcUUOuB/lJc7eNRo6zt0MmJPnoMbEY50SZpcTVXMwIGwJcE6l7BmbaaXf BsNC3VEUQ7sMA4UJd5YGXWNeOm49Jfrfuv2sjBDqWu+bg8F/H9bg45QayedebYUqJ+kX sRPIjWJajB1i58xD9Fee2DrxX4dR9JoCRpNxuFQp1vNfGkssMtOWYS4dV3TplwGIhQpB co6w== 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=FKXHx8ffzeMv7EAGaLdbGJ+dNNlnY1WK6/FxvClQgCo=; b=Bl6R8wJzzo4kun2mrw0/MT3Chfm86Srltnvenwpmu1UguLed7BqN8YbbK1MSTfWpJQ 6P7dcOheMwCPD3PHroiDk9pksdDlDZ3usTBvpzabcTf9q1guwctXjLsJlmOgctLSmV4Y UDWBqa56lOlD9gKuHEkCuds7UZ9d1UyfuWBOnvjRtGsPi3kRRLU13kaWg4+6QPgM+CFP 6tvPQ4vXRXaCHX4KzbFHPI5fuWGXZIHmRFmMIvnnHIGuMOg5ZIxORTI9wc30vVTZwgNq zeopNGBjNrxl6ffkPDbpKWFyrsaGBCkT4pklqzbxC/FeeJyVSAuTCpgi1BHr49ubo1m/ BIXA== 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 k7si264911pgo.509.2018.03.13.08.55.07; Tue, 13 Mar 2018 08:55:21 -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 S934695AbeCMPjO (ORCPT + 99 others); Tue, 13 Mar 2018 11:39:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35226 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934680AbeCMPjK (ORCPT ); Tue, 13 Mar 2018 11:39:10 -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 6C338F61; Tue, 13 Mar 2018 15:39:09 +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.14 088/140] virtio_ring: fix num_free handling in error case Date: Tue, 13 Mar 2018 16:24:51 +0100 Message-Id: <20180313152504.054138548@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@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.14-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);