Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966393AbdLSDea (ORCPT ); Mon, 18 Dec 2017 22:34:30 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2694 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965560AbdLSDcz (ORCPT ); Mon, 18 Dec 2017 22:32:55 -0500 From: Lipeng To: CC: , , , , Subject: [PATCH V2 net-next 04/17] net: hns3: Free the ring_data structrue when change tqps Date: Tue, 19 Dec 2017 12:02:26 +0800 Message-ID: <1513656159-127589-5-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513656159-127589-1-git-send-email-lipeng321@huawei.com> References: <1513656159-127589-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1018 Lines: 29 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: qumingguang Signed-off-by: Lipeng --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index be43d09..b7fe980 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2800,8 +2800,12 @@ int hns3_uninit_all_ring(struct hns3_nic_priv *priv) 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; } -- 1.9.1