* [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup()
@ 2026-01-20 13:46 Zilin Guan
2026-01-22 10:27 ` Tariq Toukan
2026-01-23 4:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Zilin Guan @ 2026-01-20 13:46 UTC (permalink / raw)
To: saeedm
Cc: leon, tariqt, mbloch, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-rdma, linux-kernel, jianhao.xu, Zilin Guan
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: 07bab9502641 ("net/mlx5: E-Switch, Refactor eswitch ingress acl codes")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
index 1c37098e09ea..49a637829c59 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
@@ -188,7 +188,7 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw,
if (IS_ERR(vport->ingress.acl)) {
err = PTR_ERR(vport->ingress.acl);
vport->ingress.acl = NULL;
- return err;
+ goto out;
}
err = esw_acl_ingress_lgcy_groups_create(esw, vport);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup()
2026-01-20 13:46 [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup() Zilin Guan
@ 2026-01-22 10:27 ` Tariq Toukan
2026-01-23 4:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-01-22 10:27 UTC (permalink / raw)
To: Zilin Guan, saeedm
Cc: leon, tariqt, mbloch, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-rdma, linux-kernel, jianhao.xu
On 20/01/2026 15:46, Zilin Guan wrote:
> 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: 07bab9502641 ("net/mlx5: E-Switch, Refactor eswitch ingress acl codes")
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
> index 1c37098e09ea..49a637829c59 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
> @@ -188,7 +188,7 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw,
> if (IS_ERR(vport->ingress.acl)) {
> err = PTR_ERR(vport->ingress.acl);
> vport->ingress.acl = NULL;
> - return err;
> + goto out;
> }
>
> err = esw_acl_ingress_lgcy_groups_create(esw, vport);
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks for your patch.
Tariq
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup()
2026-01-20 13:46 [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup() Zilin Guan
2026-01-22 10:27 ` Tariq Toukan
@ 2026-01-23 4:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-23 4:40 UTC (permalink / raw)
To: Zilin Guan
Cc: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
kuba, pabeni, netdev, linux-rdma, linux-kernel, jianhao.xu
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 20 Jan 2026 13:46:40 +0000 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup()
https://git.kernel.org/netdev/net/c/108948f723b1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-23 4:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 13:46 [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup() Zilin Guan
2026-01-22 10:27 ` Tariq Toukan
2026-01-23 4:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox