]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 21 Dec 2020 11:27:31 +0000 (19:27 +0800)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 7 Jan 2021 20:22:51 +0000 (12:22 -0800)
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: 5c6b620f0fbf ("net/mlx5e: Split the main flow steering table")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c

index 44a2dfbc38534439536fd83f33c0b674d3c2ef19..e02e5895703d5a26af3b38618b15315d0da075fe 100644 (file)
@@ -1392,6 +1392,7 @@ err_destroy_groups:
        ft->g[ft->num_groups] = NULL;
        mlx5e_destroy_groups(ft);
        kvfree(in);
+       kfree(ft->g);
 
        return err;
 }