Received: by 10.192.165.156 with SMTP id m28csp49175imm; Tue, 10 Apr 2018 16:08:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48f4l2BSyqktCjTKxokP8HCG1r1vBEnH+wOnBWR2efmA+pVzulCjzcg2XYh9qIzIlFoh7Kt X-Received: by 2002:a17:902:6b45:: with SMTP id g5-v6mr2323931plt.171.1523401724277; Tue, 10 Apr 2018 16:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401724; cv=none; d=google.com; s=arc-20160816; b=AW+v+ErXan4zH59CXcs+VmHyb0gWPE+z1wbo5rHOEvMkZ9PUvEo1ZteHu0QO3lV0/O Xx43GBQ09WRKh5q2vymEDD53oabs+yXT0SFme6ZjqekAT23jBlKK2NQGfMVakMwQ7/wQ Pz11hJVmZ+COixwtNg/zNI7bS7oJ/e6Hr98jde74y57CzXW397OaLlJ8ILzSBRSx98gp AWZjkPMXnqX7H2Dd8Z9mC00lWLYO/YLUptxJf82r6h8ODr0iWabzXW0jfTZEzY6SVq+J /MULTa4xVV5XsFnyPOsbZNSXeWQVlbka5+GTBrSzRe716ynV2aHTB4SKHNzcwO+U2PaI Re3A== 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=PFjxhHG3U/iLvgKy52762USHC3tFu61f+3Izkz4zxcA=; b=lhsx49MCcMz11FSZ3NSgNDb/w9ooIwJhdr5D9OHdtPbdvh5fcr3LPmF6hQKuu/MSYB psZ8pJs3rcsUEGCA+IKjAk7uZPBRStDXAnkbItghRPv83KUmXF9tDtlodx0yzYIhH1VF vZsSkVFvopyZihjYTlZSNh9ErjAnNai/c96Yz4TP9yk5tGZTtf9nx0jFkavnwTYVhJR6 YvSOC7OIX8xkFynCbDG1a+6MrTEQlw/Iap00wCUv+4dZzQqUmSrWiOhwXJdWTDdaxNps kxrmNeHOoXCbxbiJaoPK+ypApyok3q090iW/fmzRh2GloKGesMSzOR5+iFkCDiMP6lkq BZlQ== 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 j7si2365735pgq.426.2018.04.10.16.08.07; Tue, 10 Apr 2018 16:08:44 -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 S1755975AbeDJXDM (ORCPT + 99 others); Tue, 10 Apr 2018 19:03:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41954 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932223AbeDJWfB (ORCPT ); Tue, 10 Apr 2018 18:35:01 -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 308EFD77; Tue, 10 Apr 2018 22:35:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Li , Mingguang Qu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 012/138] net: hns3: free the ring_data structrue when change tqps Date: Wed, 11 Apr 2018 00:23:22 +0200 Message-Id: <20180410212903.575782322@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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: Peng Li [ Upstream commit 99fdf6b1cadf41bb253408589788f025027274f3 ] This patch fixes a memory leak problems in change tqps process, the function hns3_uninit_all_ring and hns3_init_all_ring may be called many times. Signed-off-by: Peng Li Signed-off-by: Mingguang Qu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -2687,8 +2687,12 @@ static int hns3_uninit_all_ring(struct h h->ae_algo->ops->reset_queue(h, i); hns3_fini_ring(priv->ring_data[i].ring); + devm_kfree(priv->dev, priv->ring_data[i].ring); hns3_fini_ring(priv->ring_data[i + h->kinfo.num_tqps].ring); + devm_kfree(priv->dev, + priv->ring_data[i + h->kinfo.num_tqps].ring); } + devm_kfree(priv->dev, priv->ring_data); return 0; }