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

From: Leon Romanovsky
Date: Sun Dec 27 2020 - 03:41:57 EST


On Mon, Dec 21, 2020 at 04:50:31PM +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().
>
> Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)

I'm not thrilled to see release in the error flow that will be done in
the different function. The missing piece is "ft->g = NULL" after kfree().

And also fixes lines are missing in all your patches.

Thanks