Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 800d8c96 authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Greg Kroah-Hartman
Browse files

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: 1d918647 ("net/mlx5: DR, Add direct rule command utilities")
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4730c0a1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -423,11 +423,12 @@ int mlx5dr_cmd_create_reformat_ctx(struct mlx5_core_dev *mdev,

	err = mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out));
	if (err)
		return err;
		goto err_free_in;

	*reformat_id = MLX5_GET(alloc_packet_reformat_context_out, out, packet_reformat_id);
	kvfree(in);

err_free_in:
	kvfree(in);
	return err;
}