]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/mlx5e: fix a potential double-free in fs_udp_create_groups
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Tue, 28 Nov 2023 09:40:53 +0000 (17:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:13:28 +0000 (15:13 +0100)
commitb0873aa484e9224cffc35887bc14649232fc68f1
tree27bca188eb384ddabbdbc90b0bf70f748e9aa8c6
parent4ddba57b659a4d462170754d96db4f37b39c9f51
net/mlx5e: fix a potential double-free in fs_udp_create_groups

[ Upstream commit e75efc6466ae289e599fb12a5a86545dff245c65 ]

When kcalloc() for ft->g succeeds but kvzalloc() for in fails,
fs_udp_create_groups() will free ft->g. However, its caller
fs_udp_create_table() will free ft->g again through calling
mlx5e_destroy_flow_table(), which will lead to a double-free.
Fix this by setting ft->g to NULL in fs_udp_create_groups().

Fixes: 1c80bd684388 ("net/mlx5e: Introduce Flow Steering UDP API")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c