[PATCH] net/mlx5: fix ipool memory leak

Rongwei Liu rongweil at nvidia.com
Wed Jul 23 08:49:22 CEST 2025


When ipool debug is enabled, there is internal memory
to maintain the ipool cache allocation. Need to free it
when destroying the ipool.

Fixes: 3a2bda363 ("net/mlx5: add ipool debug checks")
Cc: shperetz at nvidia.com
Signed-off-by: Rongwei Liu <rongweil at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
---
 drivers/net/mlx5/mlx5_utils.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
index ac218868e6..58249b596f 100644
--- a/drivers/net/mlx5/mlx5_utils.c
+++ b/drivers/net/mlx5/mlx5_utils.c
@@ -871,6 +871,10 @@ mlx5_ipool_destroy(struct mlx5_indexed_pool *pool)
 		pool->cfg.free(trunks);
 	if (gc)
 		pool->cfg.free(gc);
+#ifdef POOL_DEBUG
+	if (pool->cache_validator.bmp_mem)
+		pool->cfg.free(pool->cache_validator.bmp_mem);
+#endif
 	mlx5_ipool_unlock(pool);
 	mlx5_free(pool);
 	return 0;
-- 
2.27.0



More information about the dev mailing list