Skip to content

Commit 051fd85

Browse files
lkayal-01gregkh
authored andcommitted
net/mlx5: HWS, Fix memory leak in hws_action_get_shared_stc_nic error flow
[ Upstream commit a630f83 ] 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: 504e536 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 86d13a6 commit 051fd85

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int hws_action_get_shared_stc_nic(struct mlx5hws_context *ctx,
117117
mlx5hws_err(ctx, "No such stc_type: %d\n", stc_type);
118118
pr_warn("HWS: Invalid stc_type: %d\n", stc_type);
119119
ret = -EINVAL;
120-
goto unlock_and_out;
120+
goto free_shared_stc;
121121
}
122122

123123
ret = mlx5hws_action_alloc_single_stc(ctx, &stc_attr, tbl_type,

0 commit comments

Comments
 (0)