Skip to content

Commit 5dd7758

Browse files
zhengchaoshaoSaeed Mahameed
authored and
Saeed Mahameed
committed
net/mlx5: DR, fix memory leak in mlx5dr_cmd_create_reformat_ctx
when mlx5_cmd_exec failed in mlx5dr_cmd_create_reformat_ctx, the memory pointed by 'in' is not released, which will cause memory leak. Move memory release after mlx5_cmd_exec. Fixes: 1d91864 ("net/mlx5: DR, Add direct rule command utilities") Signed-off-by: Zhengchao Shao <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent aeb6601 commit 5dd7758

File tree

1 file changed

+3
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/steering

1 file changed

+3
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,12 @@ int mlx5dr_cmd_create_reformat_ctx(struct mlx5_core_dev *mdev,
564564

565565
err = mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out));
566566
if (err)
567-
return err;
567+
goto err_free_in;
568568

569569
*reformat_id = MLX5_GET(alloc_packet_reformat_context_out, out, packet_reformat_id);
570-
kvfree(in);
571570

571+
err_free_in:
572+
kvfree(in);
572573
return err;
573574
}
574575

0 commit comments

Comments
 (0)