net/mlx5: DR, fix memory leak in mlx5dr_cmd_create_reformat_ctx
authorZhengchao Shao <shaozhengchao@huawei.com>
Wed, 5 Jul 2023 12:15:27 +0000 (20:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 10:08:12 +0000 (12:08 +0200)
commit3169c3854397f3070a63b1b772db16dcb8cba7b4
tree9343bb3789ac815210deb85fc208ec028dfde788
parentc818fff3b6cb1a8d5216e4974c4b5f2d11ebf005
net/mlx5: DR, fix memory leak in mlx5dr_cmd_create_reformat_ctx

[ Upstream commit 5dd77585dd9d0e03dd1bceb95f0269a7eaf6b936 ]

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: 1d9186476e12 ("net/mlx5: DR, Add direct rule command utilities")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c