patch 'net/mlx5: fix double free of HWS counter pool name' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:05:49 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
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/08/26. 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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/4d4791851f4ae1cbd816e46ba705e155998d2aea
Thanks.
Kevin
---
>From 4d4791851f4ae1cbd816e46ba705e155998d2aea Mon Sep 17 00:00:00 2001
From: Maayan Kashani <mkashani at nvidia.com>
Date: Mon, 9 Nov 2026 14:57:39 +0200
Subject: [PATCH] net/mlx5: fix double free of HWS counter pool name
[ upstream commit 682a585ac0c5ee20c487a7cd644676e10565b609 ]
The pool name is a small fixed string, but it was allocated separately
and the pointer was stored in the pool config. Destroy always freed
that pointer. The create error path freed it again, which logged
"Invalid memory".
Keep the name in the pool config. The string is copied with the config,
so create and destroy no longer allocate or free it.
Fixes: 9e34fcc81c00 ("net/mlx5: fix leak in HWS flow counter action")
Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
drivers/net/mlx5/mlx5_hws_cnt.c | 13 ++-----------
drivers/net/mlx5/mlx5_hws_cnt.h | 3 ++-
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c
index 1b6acb7a3b..8192310d9c 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.c
+++ b/drivers/net/mlx5/mlx5_hws_cnt.c
@@ -734,16 +734,9 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
struct mlx5_hws_cache_param cparam = {0};
struct mlx5_hws_cnt_pool_cfg pcfg = {0};
- char *mp_name;
int ret = 0;
size_t sz;
- mp_name = mlx5_malloc(MLX5_MEM_ZERO, RTE_MEMZONE_NAMESIZE, 0, SOCKET_ID_ANY);
- if (mp_name == NULL) {
- ret = rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
- "failed to allocate counter pool name prefix");
- goto error;
- }
- snprintf(mp_name, RTE_MEMZONE_NAMESIZE, "MLX5_HWS_CNT_P_%x", dev->data->port_id);
- pcfg.name = mp_name;
+ snprintf(pcfg.name, sizeof(pcfg.name), "MLX5_HWS_CNT_P_%x",
+ dev->data->port_id);
pcfg.request_num = nb_counters;
pcfg.alloc_factor = HWS_CNT_ALLOC_FACTOR_DEFAULT;
@@ -818,5 +811,4 @@ error:
mlx5_hws_cnt_pool_destroy(priv->sh, cpool);
priv->hws_cpool = NULL;
- mlx5_free(mp_name);
return ret;
}
@@ -846,5 +838,4 @@ mlx5_hws_cnt_pool_destroy(struct mlx5_dev_ctx_shared *sh,
mlx5_hws_cnt_raw_data_free(sh, cpool->raw_mng);
}
- mlx5_free((void *)cpool->cfg.name);
mlx5_hws_cnt_pool_deinit(cpool);
}
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index 63a14f4f7a..5a55820abe 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -6,4 +6,5 @@
#define _MLX5_HWS_CNT_H_
+#include <rte_memzone.h>
#include <rte_ring.h>
#include "mlx5_utils.h"
@@ -88,5 +89,5 @@ struct mlx5_hws_cache_param {
struct mlx5_hws_cnt_pool_cfg {
- char *name;
+ char name[RTE_MEMZONE_NAMESIZE];
uint32_t request_num;
uint32_t alloc_factor;
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:51.157075337 +0000
+++ 0423-net-mlx5-fix-double-free-of-HWS-counter-pool-name.patch 2026-12-03 12:52:39.325938810 +0000
@@ -1 +1 @@
-From 682a585ac0c5ee20c487a7cd644676e10565b609 Mon Sep 17 00:00:00 2001
+From 4d4791851f4ae1cbd816e46ba705e155998d2aea Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 682a585ac0c5ee20c487a7cd644676e10565b609 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -25 +26 @@
-index d0c4ead71b..d6f713fd9b 100644
+index 1b6acb7a3b..8192310d9c 100644
@@ -28 +29 @@
-@@ -731,16 +731,9 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
+@@ -734,16 +734,9 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
@@ -47 +48 @@
-@@ -815,5 +808,4 @@ error:
+@@ -818,5 +811,4 @@ error:
@@ -53,2 +54,2 @@
-@@ -843,5 +835,4 @@ mlx5_hws_cnt_pool_destroy(struct mlx5_dev_ctx_shared *sh,
- mlx5_hws_cnt_raw_data_free(cpool->raw_mng);
+@@ -846,5 +838,4 @@ mlx5_hws_cnt_pool_destroy(struct mlx5_dev_ctx_shared *sh,
+ mlx5_hws_cnt_raw_data_free(sh, cpool->raw_mng);
More information about the stable
mailing list