Skip to content

Commit ca20c7a

Browse files
lkayal-01gregkh
authored andcommitted
net/mlx5: HWS, Fix pattern destruction in mlx5hws_pat_get_pattern error path
[ Upstream commit 00a50e4 ] In mlx5hws_pat_get_pattern(), when mlx5hws_pat_add_pattern_to_cache() fails, the function attempts to clean up the pattern created by mlx5hws_cmd_header_modify_pattern_create(). However, it incorrectly uses *pattern_id which hasn't been set yet, instead of the local ptrn_id variable that contains the actual pattern ID. This results in attempting to destroy a pattern using uninitialized data from the output parameter, rather than the valid pattern ID returned by the firmware. Use ptrn_id instead of *pattern_id in the cleanup path to properly destroy the created pattern. Fixes: aefc15a ("net/mlx5: HWS, added modify header pattern and args 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-5-mbloch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3668ba8 commit ca20c7a

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/pat_arg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ int mlx5hws_pat_get_pattern(struct mlx5hws_context *ctx,
279279
return ret;
280280

281281
clean_pattern:
282-
mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, *pattern_id);
282+
mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, ptrn_id);
283283
out_unlock:
284284
mutex_unlock(&ctx->pattern_cache->lock);
285285
return ret;

0 commit comments

Comments
 (0)