Skip to content

Commit aef855d

Browse files
dinghaoliuSaeed Mahameed
authored andcommitted
net/mlx5e: fix a potential double-free in fs_any_create_groups
When kcalloc() for ft->g succeeds but kvzalloc() for in fails, fs_any_create_groups() will free ft->g. However, its caller fs_any_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_any_create_groups(). Fixes: 0f575c2 ("net/mlx5e: Introduce Flow Steering ANY 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>
1 parent 3c6d518 commit aef855d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ static int fs_any_create_groups(struct mlx5e_flow_table *ft)
436436
in = kvzalloc(inlen, GFP_KERNEL);
437437
if (!in || !ft->g) {
438438
kfree(ft->g);
439+
ft->g = NULL;
439440
kvfree(in);
440441
return -ENOMEM;
441442
}

0 commit comments

Comments
 (0)