Skip to content

Commit 108948f

Browse files
GoodLuck612kuba-moo
authored andcommitted
net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup()
In esw_acl_ingress_lgcy_setup(), if esw_acl_table_create() fails, the function returns directly without releasing the previously created counter, leading to a memory leak. Fix this by jumping to the out label instead of returning directly, which aligns with the error handling logic of other paths in this function. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: 07bab95 ("net/mlx5: E-Switch, Refactor eswitch ingress acl codes") Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20260120134640.2717808-1-zilin@seu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0a80e38 commit 108948f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw,
188188
if (IS_ERR(vport->ingress.acl)) {
189189
err = PTR_ERR(vport->ingress.acl);
190190
vport->ingress.acl = NULL;
191-
return err;
191+
goto out;
192192
}
193193

194194
err = esw_acl_ingress_lgcy_groups_create(esw, vport);

0 commit comments

Comments
 (0)