Skip to content

Commit 124d1ff

Browse files
zhengchaoshaoBrian Maly
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]> Orabug: 35622106 (cherry picked from commit 3250aff) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: 3250aff Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent fed488e commit 124d1ff

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
@@ -596,7 +596,7 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
596596

597597
err = fs_any_create_table(fs);
598598
if (err)
599-
return err;
599+
goto err_free_any;
600600

601601
err = fs_any_enable(fs);
602602
if (err)
@@ -608,8 +608,8 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
608608

609609
err_destroy_table:
610610
fs_any_destroy_table(fs_any);
611-
612-
kfree(fs_any);
611+
err_free_any:
613612
mlx5e_fs_set_any(fs, NULL);
613+
kfree(fs_any);
614614
return err;
615615
}

0 commit comments

Comments
 (0)