Skip to content

Commit 3250aff

Browse files
zhengchaoshaoSaeed Mahameed
authored andcommitted
net/mlx5e: fix memory leak in mlx5e_fs_tt_redirect_any_create
The memory pointed to by the fs->any pointer is not freed in the error path of mlx5e_fs_tt_redirect_any_create, which can lead to a memory leak. Fix by freeing the memory in the error path, thereby making the error path identical to mlx5e_fs_tt_redirect_any_destroy(). Fixes: 0f575c2 ("net/mlx5e: Introduce Flow Steering ANY API") Signed-off-by: Zhengchao Shao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Rahul Rameshbabu <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 884abe4 commit 3250aff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
594594

595595
err = fs_any_create_table(fs);
596596
if (err)
597-
return err;
597+
goto err_free_any;
598598

599599
err = fs_any_enable(fs);
600600
if (err)
@@ -606,8 +606,8 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
606606

607607
err_destroy_table:
608608
fs_any_destroy_table(fs_any);
609-
610-
kfree(fs_any);
609+
err_free_any:
611610
mlx5e_fs_set_any(fs, NULL);
611+
kfree(fs_any);
612612
return err;
613613
}

0 commit comments

Comments
 (0)