aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLama Kayal <lkayal@nvidia.com>2025-08-25 17:34:25 +0300
committerJakub Kicinski <kuba@kernel.org>2025-08-26 18:00:25 -0700
commita630f83592cdad1253523a1b760cfe78fef6cd9c (patch)
tree6f03b2d2ff55c65c51ac2d9dd8e8be66dee17a32
parentnet/mlx5: HWS, Fix memory leak in hws_pool_buddy_init error path (diff)
downloadwireguard-linux-a630f83592cdad1253523a1b760cfe78fef6cd9c.tar.xz
wireguard-linux-a630f83592cdad1253523a1b760cfe78fef6cd9c.zip
net/mlx5: HWS, Fix memory leak in hws_action_get_shared_stc_nic error flow
When an invalid stc_type is provided, the function allocates memory for shared_stc but jumps to unlock_and_out without freeing it, causing a memory leak. Fix by jumping to free_shared_stc label instead to ensure proper cleanup. Fixes: 504e536d9010 ("net/mlx5: HWS, added actions 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-3-mbloch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
index 396804369b00..6b36a4a7d895 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
@@ -117,7 +117,7 @@ static int hws_action_get_shared_stc_nic(struct mlx5hws_context *ctx,
mlx5hws_err(ctx, "No such stc_type: %d\n", stc_type);
pr_warn("HWS: Invalid stc_type: %d\n", stc_type);
ret = -EINVAL;
- goto unlock_and_out;
+ goto free_shared_stc;
}
ret = mlx5hws_action_alloc_single_stc(ctx, &stc_attr, tbl_type,