net/mlx5/hws: fix memory leak on general pool db init

Message ID 20230111194903.27180-1-valex@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5/hws: fix memory leak on general pool db init |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Alex Vesker Jan. 11, 2023, 7:49 p.m. UTC
  On elemend db init we allocated the element_manager
which was unused and not freed.

Fixes: b4dd7bcb0dcbe ("net/mlx5/hws: add pool and buddy")
Signed-off-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_pool.c | 7 -------
 1 file changed, 7 deletions(-)
  

Comments

Matan Azrad Jan. 26, 2023, 12:34 p.m. UTC | #1
From: Alex Vesker <valex@nvidia.com>
> On elemend db init we allocated the element_manager which was unused
> and not freed.
> 
> Fixes: b4dd7bcb0dcbe ("net/mlx5/hws: add pool and buddy")
> Signed-off-by: Alex Vesker <valex@nvidia.com>
> Reviewed-by: Erez Shitrit <erezsh@nvidia.com>

Acked-by: Matan Azrad <matan@nvidia.com>
  
Raslan Darawsheh Feb. 12, 2023, 1:34 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: Alex Vesker <valex@nvidia.com>
> Sent: Wednesday, January 11, 2023 9:49 PM
> To: Alex Vesker <valex@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; Suanming Mou <suanmingm@nvidia.com>;
> Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; Ori Kam <orika@nvidia.com>
> Subject: [PATCH] net/mlx5/hws: fix memory leak on general pool db init
> 
> On elemend db init we allocated the element_manager which was unused
> and not freed.
> 
> Fixes: b4dd7bcb0dcbe ("net/mlx5/hws: add pool and buddy")
> Signed-off-by: Alex Vesker <valex@nvidia.com>
> Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
> ---

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c
index fdbd3d438d..af6a5c743b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pool.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pool.c
@@ -464,13 +464,6 @@  static void mlx5dr_pool_general_element_db_uninit(struct mlx5dr_pool *pool)
  */
 static int mlx5dr_pool_general_element_db_init(struct mlx5dr_pool *pool)
 {
-	pool->db.element_manager = simple_calloc(1, sizeof(*pool->db.element_manager));
-	if (!pool->db.element_manager) {
-		DR_LOG(ERR, "No mem for general elemnt_manager");
-		rte_errno = ENOMEM;
-		return rte_errno;
-	}
-
 	pool->p_db_uninit = &mlx5dr_pool_general_element_db_uninit;
 	pool->p_get_chunk = &mlx5dr_pool_general_element_db_get_chunk;
 	pool->p_put_chunk = &mlx5dr_pool_general_element_db_put_chunk;