public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix meter ASO action leak on release to pool
@ 2026-03-15  8:36 Shani Peretz
  2026-03-24 12:22 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Shani Peretz @ 2026-03-15  8:36 UTC (permalink / raw)
  To: dev
  Cc: rasland, Shani Peretz, stable, Dariusz Sosnowski,
	Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
	Matan Azrad, Li Zhang

flow_dv_aso_mtr_release_to_pool() uses memset to zero the entire
mlx5_flow_meter_info struct when returning a meter to the free pool.
This erases the meter_action_g and meter_action_y pointers without
calling destroy_flow_action on the underlying DR ASO actions.

The leak compounds on repeated meter create/destroy cycles because
the caching check in flow_dv_mtr_alloc() — if (!fm.meter_action_g) —
always sees NULL and allocates a new action every time instead of
reusing the existing one.
At shutdown, mlx5_aso_flow_mtrs_mng_close() also skips destruction
since the pointers are already NULL.

Fixed by saving and restoring meter_action_g and meter_action_y across
the memset so the cached actions survive pool recycling and are
properly destroyed only at shutdown.

Fixes: e6100c7b6226 ("net/mlx5: add flow meter pool to manage meter object")
Cc: stable@dpdk.org

Signed-off-by: Shani Peretz <shperetz@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d1bed18077..32e75b063f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7286,10 +7286,16 @@ flow_dv_aso_mtr_release_to_pool(struct rte_eth_dev *dev, uint32_t mtr_idx)
 	struct mlx5_aso_mtr_pools_mng *pools_mng =
 				&priv->sh->mtrmng->pools_mng;
 	struct mlx5_aso_mtr *aso_mtr = mlx5_aso_meter_by_idx(priv, mtr_idx);
+	void *meter_action_g;
+	void *meter_action_y;
 
 	MLX5_ASSERT(aso_mtr);
 	rte_spinlock_lock(&pools_mng->mtrsl);
+	meter_action_g = aso_mtr->fm.meter_action_g;
+	meter_action_y = aso_mtr->fm.meter_action_y;
 	memset(&aso_mtr->fm, 0, sizeof(struct mlx5_flow_meter_info));
+	aso_mtr->fm.meter_action_g = meter_action_g;
+	aso_mtr->fm.meter_action_y = meter_action_y;
 	aso_mtr->state = ASO_METER_FREE;
 	LIST_INSERT_HEAD(&pools_mng->meters, aso_mtr, next);
 	rte_spinlock_unlock(&pools_mng->mtrsl);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/mlx5: fix meter ASO action leak on release to pool
  2026-03-15  8:36 [PATCH] net/mlx5: fix meter ASO action leak on release to pool Shani Peretz
@ 2026-03-24 12:22 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2026-03-24 12:22 UTC (permalink / raw)
  To: Shani Peretz, dev
  Cc: stable, Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao,
	Ori Kam, Suanming Mou, Matan Azrad, Li Zhang

Hi,


On 15/03/2026 10:36 AM, Shani Peretz wrote:
> flow_dv_aso_mtr_release_to_pool() uses memset to zero the entire
> mlx5_flow_meter_info struct when returning a meter to the free pool.
> This erases the meter_action_g and meter_action_y pointers without
> calling destroy_flow_action on the underlying DR ASO actions.
> 
> The leak compounds on repeated meter create/destroy cycles because
> the caching check in flow_dv_mtr_alloc() — if (!fm.meter_action_g) —
> always sees NULL and allocates a new action every time instead of
> reusing the existing one.
> At shutdown, mlx5_aso_flow_mtrs_mng_close() also skips destruction
> since the pointers are already NULL.
> 
> Fixed by saving and restoring meter_action_g and meter_action_y across
> the memset so the cached actions survive pool recycling and are
> properly destroyed only at shutdown.
> 
> Fixes: e6100c7b6226 ("net/mlx5: add flow meter pool to manage meter object")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>
> Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-24 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15  8:36 [PATCH] net/mlx5: fix meter ASO action leak on release to pool Shani Peretz
2026-03-24 12:22 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox