From: Dinghao Liu Date: Mon, 21 Dec 2020 11:27:31 +0000 (+0800) Subject: net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups X-Git-Tag: v5.15~2024^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b0bb12c58ac7d22e05b5bfdaa30a116c8c32e32;p=platform%2Fkernel%2Flinux-starfive.git net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups When mlx5_create_flow_group() fails, ft->g should be freed just like when kvzalloc() fails. The caller of mlx5e_create_l2_table_groups() does not catch this issue on failure, which leads to memleak. Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table") Signed-off-by: Dinghao Liu Reviewed-by: Leon Romanovsky Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index 44a2dfb..e02e589 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1392,6 +1392,7 @@ err_destroy_groups: ft->g[ft->num_groups] = NULL; mlx5e_destroy_groups(ft); kvfree(in); + kfree(ft->g); return err; }