patch 'net/nfp: fix resource leak for device initialization' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Tue Mar 5 10:46:54 CET 2024


Hi,

FYI, your patch has been queued to stable release 23.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/31/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=f2ee31d52cdea323cbc686c99f5131cf22f4b250

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From f2ee31d52cdea323cbc686c99f5131cf22f4b250 Mon Sep 17 00:00:00 2001
From: Chaoyong He <chaoyong.he at corigine.com>
Date: Mon, 4 Dec 2023 09:57:12 +0800
Subject: [PATCH] net/nfp: fix resource leak for device initialization
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 3699456672516a11bf6cb4b456618d2dd12080e4 ]

Fix the resource leak problem in the abnormal logic of device
initialize function.

Fixes: f26e82397f6d ("net/nfp: implement xstats")
Fixes: 547137405be7 ("net/nfp: initialize IPsec related content")

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f02caf8056..25feb8e394 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -590,9 +590,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)

 		net_hw->mac_stats = net_hw->mac_stats_bar;
 	} else {
-		if (pf_dev->ctrl_bar == NULL)
-			return -ENODEV;
-
 		/* Use port offset in pf ctrl_bar for this ports control bar */
 		hw->ctrl_bar = pf_dev->ctrl_bar + (port * NFP_NET_CFG_BAR_SZ);
 		net_hw->mac_stats = app_fw_nic->ports[0]->mac_stats_bar +
@@ -604,18 +601,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev)

 	err = nfp_net_common_init(pci_dev, net_hw);
 	if (err != 0)
-		return err;
+		goto free_area;

 	err = nfp_net_tlv_caps_parse(eth_dev);
 	if (err != 0) {
 		PMD_INIT_LOG(ERR, "Failed to parser TLV caps");
 		return err;
+		goto free_area;
 	}

 	err = nfp_ipsec_init(eth_dev);
 	if (err != 0) {
 		PMD_INIT_LOG(ERR, "Failed to init IPsec module");
-		return err;
+		goto free_area;
 	}

 	nfp_net_ethdev_ops_mount(net_hw, eth_dev);
@@ -625,7 +623,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	if (net_hw->eth_xstats_base == NULL) {
 		PMD_INIT_LOG(ERR, "no memory for xstats base values on device %s!",
 				pci_dev->device.name);
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto ipsec_exit;
 	}

 	/* Work out where in the BAR the queues start. */
@@ -655,7 +654,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to space for MAC address");
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto xstats_free;
 	}

 	nfp_net_pf_read_mac(app_fw_nic, port);
@@ -693,6 +693,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	nfp_net_stats_reset(eth_dev);

 	return 0;
+
+xstats_free:
+	rte_free(net_hw->eth_xstats_base);
+ipsec_exit:
+	nfp_ipsec_uninit(eth_dev);
+free_area:
+	if (net_hw->mac_stats_area != NULL)
+		nfp_cpp_area_release_free(net_hw->mac_stats_area);
+
+	return err;
 }

 #define DEFAULT_FW_PATH       "/lib/firmware/netronome"
--
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-03-05 17:39:33.179452373 +0800
+++ 0073-net-nfp-fix-resource-leak-for-device-initialization.patch	2024-03-05 17:39:30.803566494 +0800
@@ -1 +1 @@
-From 3699456672516a11bf6cb4b456618d2dd12080e4 Mon Sep 17 00:00:00 2001
+From f2ee31d52cdea323cbc686c99f5131cf22f4b250 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 3699456672516a11bf6cb4b456618d2dd12080e4 ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
-index 9e40bce4dd..2a80a592f2 100644
+index f02caf8056..25feb8e394 100644
@@ -24 +26 @@
-@@ -597,9 +597,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
+@@ -590,9 +590,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
@@ -34 +36 @@
-@@ -611,18 +608,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
+@@ -604,18 +601,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
@@ -56 +58 @@
-@@ -632,7 +630,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
+@@ -625,7 +623,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
@@ -66 +68 @@
-@@ -662,7 +661,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
+@@ -655,7 +654,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
@@ -76 +78 @@
-@@ -700,6 +700,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
+@@ -693,6 +693,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev)


More information about the stable mailing list