Skip to content

Commit 00a50e4

Browse files
lkayal-01kuba-moo
authored andcommitted
net/mlx5: HWS, Fix pattern destruction in mlx5hws_pat_get_pattern error path
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 <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 24b6e53 commit 00a50e4

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)