Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932877AbdLRJBu (ORCPT ); Mon, 18 Dec 2017 04:01:50 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:48142 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932832AbdLRJBr (ORCPT ); Mon, 18 Dec 2017 04:01:47 -0500 From: Lipeng To: CC: , , , , Subject: [PATCH net-next 04/17] net: hns3: Free the ring_data structrue when change tqps Date: Mon, 18 Dec 2017 17:31:27 +0800 Message-ID: <1513589500-121623-5-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513589500-121623-1-git-send-email-lipeng321@huawei.com> References: <1513589500-121623-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: 1016 Lines: 29 This patch fix 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 e52de45..2aeddf9 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