From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D764A0524 for ; Thu, 4 Feb 2021 12:38:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86D282407A3; Thu, 4 Feb 2021 12:38:56 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 842B0240790 for ; Thu, 4 Feb 2021 12:38:55 +0100 (CET) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l7cyN-0005mH-AG; Thu, 04 Feb 2021 11:38:55 +0000 From: Christian Ehrhardt To: Lijun Ou Cc: dpdk stable Date: Thu, 4 Feb 2021 12:29:53 +0100 Message-Id: <20210204112954.2488123-138-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> References: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix memory leak on secondary process exit' has been queued to stable release 19.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/06/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/77c7e32d8737b2fe024bfcbe3703bec28201efac Thanks. Christian Ehrhardt --- >From 77c7e32d8737b2fe024bfcbe3703bec28201efac Mon Sep 17 00:00:00 2001 From: Lijun Ou Date: Fri, 22 Jan 2021 18:18:46 +0800 Subject: [PATCH] net/hns3: fix memory leak on secondary process exit [ upstream commit 4101114586e42e3dfb0dee2e5b054dee3074e63f ] The secondary process is applied a memory for the process_private during initialization. Therefore, the memory needs to be released when exiting. Fixes: c203571b3602 ("net/hns3: register and add log interface") Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_ethdev.c | 7 +++++-- drivers/net/hns3/hns3_ethdev_vf.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 343ee96d79..33b3ccc865 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5553,8 +5553,11 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + rte_free(eth_dev->process_private); + eth_dev->process_private = NULL; + return 0; + } eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index d8a2a8dcf3..f7bd2b4672 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1643,8 +1643,10 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) struct hns3_adapter *hns = eth_dev->data->dev_private; struct hns3_hw *hw = &hns->hw; - if (rte_eal_process_type() != RTE_PROC_PRIMARY) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + rte_free(eth_dev->process_private); return; + } if (hw->adapter_state == HNS3_NIC_STARTED) hns3vf_dev_stop(eth_dev); @@ -2371,8 +2373,11 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + rte_free(eth_dev->process_private); + eth_dev->process_private = NULL; + return 0; + } eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; -- 2.30.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-04 12:04:33.589353013 +0100 +++ 0138-net-hns3-fix-memory-leak-on-secondary-process-exit.patch 2021-02-04 12:04:28.214789907 +0100 @@ -1 +1 @@ -From 4101114586e42e3dfb0dee2e5b054dee3074e63f Mon Sep 17 00:00:00 2001 +From 77c7e32d8737b2fe024bfcbe3703bec28201efac Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4101114586e42e3dfb0dee2e5b054dee3074e63f ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -16,2 +17,2 @@ - drivers/net/hns3/hns3_ethdev_vf.c | 12 +++++++++--- - 2 files changed, 14 insertions(+), 5 deletions(-) + drivers/net/hns3/hns3_ethdev_vf.c | 11 ++++++++--- + 2 files changed, 13 insertions(+), 5 deletions(-) @@ -20 +21 @@ -index c5dccec5ae..b89bc48714 100644 +index 343ee96d79..33b3ccc865 100644 @@ -23 +24 @@ -@@ -6263,8 +6263,11 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) +@@ -5553,8 +5553,11 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) @@ -35,2 +36,2 @@ - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3_dev_close(eth_dev); + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; @@ -38 +39 @@ -index 063f2f5c2f..5bf8c2e8fd 100644 +index d8a2a8dcf3..f7bd2b4672 100644 @@ -41 +42,2 @@ -@@ -1971,8 +1971,11 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) +@@ -1643,8 +1643,10 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) + struct hns3_adapter *hns = eth_dev->data->dev_private; @@ -43 +44,0 @@ - int ret = 0; @@ -48,3 +49,2 @@ -+ eth_dev->process_private = NULL; - return 0; -+ } + return; ++ } @@ -53,2 +53,2 @@ - ret = hns3vf_dev_stop(eth_dev); -@@ -2839,8 +2842,11 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) + hns3vf_dev_stop(eth_dev); +@@ -2371,8 +2373,11 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) @@ -66,2 +66,2 @@ - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3vf_dev_close(eth_dev); + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL;