Skip to content

Commit 86d13a6

Browse files
lkayal-01gregkh
authored andcommitted
net/mlx5: HWS, Fix memory leak in hws_pool_buddy_init error path
[ Upstream commit 2c0a959 ] In the error path of hws_pool_buddy_init(), the buddy allocator cleanup doesn't free the allocator structure itself, causing a memory leak. Add the missing kfree() to properly release all allocated memory. Fixes: c61afff ("net/mlx5: HWS, added memory management handling") Signed-off-by: Lama Kayal <lkayal@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Mark Bloch <mbloch@nvidia.com> Link: https://patch.msgid.link/20250825143435.598584-2-mbloch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5c5f9f4 commit 86d13a6

File tree

1 file changed

+1
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/steering/hws

1 file changed

+1
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static int hws_pool_buddy_init(struct mlx5hws_pool *pool)
124124
mlx5hws_err(pool->ctx, "Failed to create resource type: %d size %zu\n",
125125
pool->type, pool->alloc_log_sz);
126126
mlx5hws_buddy_cleanup(buddy);
127+
kfree(buddy);
127128
return -ENOMEM;
128129
}
129130

0 commit comments

Comments
 (0)