patch 'net/mlx5: fix memory leak in metering' has been queued to stable release 23.11.3
Xueming Li
xuemingl at nvidia.com
Sat Dec 7 08:59:31 CET 2024
Hi,
FYI, your patch has been queued to stable release 23.11.3
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/10/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=4e2de6fbed81e68f9a92807bfbb259482b6973ba
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 4e2de6fbed81e68f9a92807bfbb259482b6973ba Mon Sep 17 00:00:00 2001
From: Shun Hao <shunh at nvidia.com>
Date: Wed, 23 Oct 2024 09:22:15 +0300
Subject: [PATCH] net/mlx5: fix memory leak in metering
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd ]
Avoid allocating memory for meter profile table when meter is not
enabled. This memory was not being freed in the close process when
meter was disabled, potentially causing a leak.
Fixes: a295c69a8b24 ("net/mlx5: optimize meter profile lookup")
Signed-off-by: Shun Hao <shunh at nvidia.com>
Acked-by: Bing Zhao <bingz at nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 8 +++++---
drivers/net/mlx5/mlx5_flow_meter.c | 4 ++--
drivers/net/mlx5/windows/mlx5_os.c | 8 +++++---
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 2241e84341..9dcdc8581a 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1570,9 +1570,11 @@ err_secondary:
priv->ctrl_flows = 0;
rte_spinlock_init(&priv->flow_list_lock);
TAILQ_INIT(&priv->flow_meters);
- priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR);
- if (!priv->mtr_profile_tbl)
- goto error;
+ if (priv->mtr_en) {
+ priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR);
+ if (!priv->mtr_profile_tbl)
+ goto error;
+ }
/* Bring Ethernet device up. */
DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
eth_dev->data->port_id);
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 7bf5018c70..a4d954cb1f 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -100,8 +100,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id)
if (priv->mtr_profile_arr)
return &priv->mtr_profile_arr[meter_profile_id];
- if (mlx5_l3t_get_entry(priv->mtr_profile_tbl,
- meter_profile_id, &data) || !data.ptr)
+ if (!priv->mtr_profile_tbl ||
+ mlx5_l3t_get_entry(priv->mtr_profile_tbl, meter_profile_id, &data) || !data.ptr)
return NULL;
fmp = data.ptr;
/* Remove reference taken by the mlx5_l3t_get_entry. */
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index b731bdff06..a9614b125b 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -518,9 +518,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
priv->ctrl_flows = 0;
TAILQ_INIT(&priv->flow_meters);
- priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR);
- if (!priv->mtr_profile_tbl)
- goto error;
+ if (priv->mtr_en) {
+ priv->mtr_profile_tbl = mlx5_l3t_create(MLX5_L3T_TYPE_PTR);
+ if (!priv->mtr_profile_tbl)
+ goto error;
+ }
/* Bring Ethernet device up. */
DRV_LOG(DEBUG, "port %u forcing Ethernet interface up.",
eth_dev->data->port_id);
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-12-06 23:26:44.581205921 +0800
+++ 0013-net-mlx5-fix-memory-leak-in-metering.patch 2024-12-06 23:26:43.863044829 +0800
@@ -1 +1 @@
-From 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd Mon Sep 17 00:00:00 2001
+From 4e2de6fbed81e68f9a92807bfbb259482b6973ba Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 4dd46d38820e0bf5e74f99b84f4b098d1b7220dd ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -22 +24 @@
-index 7d0d4bf23b..69a80b9ddc 100644
+index 2241e84341..9dcdc8581a 100644
@@ -25 +27 @@
-@@ -1612,9 +1612,11 @@ err_secondary:
+@@ -1570,9 +1570,11 @@ err_secondary:
@@ -41 +43 @@
-index 19d8607070..98a61cbdd4 100644
+index 7bf5018c70..a4d954cb1f 100644
@@ -44 +46 @@
-@@ -378,8 +378,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id)
+@@ -100,8 +100,8 @@ mlx5_flow_meter_profile_find(struct mlx5_priv *priv, uint32_t meter_profile_id)
@@ -56 +58 @@
-index 80f1679388..268598f209 100644
+index b731bdff06..a9614b125b 100644
@@ -59 +61 @@
-@@ -521,9 +521,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
+@@ -518,9 +518,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
More information about the stable
mailing list