Re: [PATCH] [v2] net/mlx5e: Fix two double free cases

From: Leon Romanovsky
Date: Mon Dec 28 2020 - 06:17:06 EST


On Mon, Dec 28, 2020 at 04:48:40PM +0800, Dinghao Liu wrote:
> mlx5e_create_ttc_table_groups() frees ft->g on failure of
> kvzalloc(), but such failure will be caught by its caller
> in mlx5e_create_ttc_table() and ft->g will be freed again
> in mlx5e_destroy_flow_table(). The same issue also occurs
> in mlx5e_create_ttc_table_groups(). Set ft->g to NULL after
> kfree() to avoid double free.
>
> Fixes: 7b3722fa9ef64 ("net/mlx5e: Support RSS for GRE tunneled packets")
> Fixes: 33cfaaa8f36ff ("net/mlx5e: Split the main flow steering table")
> Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
> ---
>
> Changelog:
>
> v2: - Set ft->g to NULL after kfree() instead of removing kfree().
> Refine commit message.
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>