netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation
@ 2023-02-22  9:06 Leon Romanovsky
  2023-02-23 10:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2023-02-22  9:06 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Patrisious Haddad, Eric Dumazet, linux-rdma, Mark Zhang, netdev,
	Paolo Abeni, Raed Salem, Saeed Mahameed

From: Patrisious Haddad <phaddad@nvidia.com>

During IPsec RoCE TX creation a struct for the flow group creation is
allocated, but never freed. Free that struct once it is no longer in use.

Fixes: 22551e77e550 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
Changelog:
v1:
 * Changed target from net-next to net.
 * Replaced goto labels to mark what they do.
v0: https://lore.kernel.org/all/1b414ea3a92aa0d07b6261cf641445f27bc619d8.1676811549.git.leon@kernel.org
---
 .../ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
index 2c53589b765d..6e3f178d6f84 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
@@ -162,7 +162,7 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
 	if (IS_ERR(ft)) {
 		err = PTR_ERR(ft);
 		mlx5_core_err(mdev, "Fail to create RoCE IPsec tx ft err=%d\n", err);
-		return err;
+		goto free_in;
 	}
 
 	roce->ft = ft;
@@ -174,22 +174,25 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
 	if (IS_ERR(g)) {
 		err = PTR_ERR(g);
 		mlx5_core_err(mdev, "Fail to create RoCE IPsec tx group err=%d\n", err);
-		goto fail;
+		goto destroy_table;
 	}
 	roce->g = g;
 
 	err = ipsec_fs_roce_tx_rule_setup(mdev, roce, pol_ft);
 	if (err) {
 		mlx5_core_err(mdev, "Fail to create RoCE IPsec tx rules err=%d\n", err);
-		goto rule_fail;
+		goto destroy_group;
 	}
 
+	kvfree(in);
 	return 0;
 
-rule_fail:
+destroy_group:
 	mlx5_destroy_flow_group(roce->g);
-fail:
+destroy_table:
 	mlx5_destroy_flow_table(ft);
+free_in:
+	kvfree(in);
 	return err;
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation
  2023-02-22  9:06 [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation Leon Romanovsky
@ 2023-02-23 10:30 ` patchwork-bot+netdevbpf
  2023-02-23 22:49   ` Saeed Mahameed
  0 siblings, 1 reply; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-23 10:30 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: davem, kuba, phaddad, edumazet, linux-rdma, markzhang, netdev,
	pabeni, raeds, saeedm

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 22 Feb 2023 11:06:40 +0200 you wrote:
> From: Patrisious Haddad <phaddad@nvidia.com>
> 
> During IPsec RoCE TX creation a struct for the flow group creation is
> allocated, but never freed. Free that struct once it is no longer in use.
> 
> Fixes: 22551e77e550 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
> Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [net,v1] net/mlx5: Fix memory leak in IPsec RoCE creation
    https://git.kernel.org/netdev/net/c/c749e3f82a15

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] 4+ messages in thread

* Re: [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation
  2023-02-23 10:30 ` patchwork-bot+netdevbpf
@ 2023-02-23 22:49   ` Saeed Mahameed
  2023-02-24  0:14     ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Saeed Mahameed @ 2023-02-23 22:49 UTC (permalink / raw)
  To: patchwork-bot+netdevbpf
  Cc: Leon Romanovsky, davem, kuba, phaddad, edumazet, linux-rdma,
	markzhang, netdev, pabeni, raeds, saeedm

On 23 Feb 10:30, patchwork-bot+netdevbpf@kernel.org wrote:
>Hello:
>
>This patch was applied to netdev/net.git (master)
>by Paolo Abeni <pabeni@redhat.com>:
>
>On Wed, 22 Feb 2023 11:06:40 +0200 you wrote:
>> From: Patrisious Haddad <phaddad@nvidia.com>
>>
>> During IPsec RoCE TX creation a struct for the flow group creation is
>> allocated, but never freed. Free that struct once it is no longer in use.
>>
>> Fixes: 22551e77e550 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
>> Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
>> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
>>
>> [...]
>
>Here is the summary with links:
>  - [net,v1] net/mlx5: Fix memory leak in IPsec RoCE creation
>    https://git.kernel.org/netdev/net/c/c749e3f82a15
>

hmm, I don't see this one in net branch, should i resubmit via my queue? 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation
  2023-02-23 22:49   ` Saeed Mahameed
@ 2023-02-24  0:14     ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-02-24  0:14 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: patchwork-bot+netdevbpf, Leon Romanovsky, davem, phaddad,
	edumazet, linux-rdma, markzhang, netdev, pabeni, raeds, saeedm

On Thu, 23 Feb 2023 14:49:09 -0800 Saeed Mahameed wrote:
> On 23 Feb 10:30, patchwork-bot+netdevbpf@kernel.org wrote:
> >Hello:
> >
> >This patch was applied to netdev/net.git (master)
> >by Paolo Abeni <pabeni@redhat.com>:
> >
> >On Wed, 22 Feb 2023 11:06:40 +0200 you wrote:  
> >> From: Patrisious Haddad <phaddad@nvidia.com>
> >>
> >> During IPsec RoCE TX creation a struct for the flow group creation is
> >> allocated, but never freed. Free that struct once it is no longer in use.
> >>
> >> Fixes: 22551e77e550 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
> >> Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
> >> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> >>
> >> [...]  
> >
> >Here is the summary with links:
> >  - [net,v1] net/mlx5: Fix memory leak in IPsec RoCE creation
> >    https://git.kernel.org/netdev/net/c/c749e3f82a15
> >  
> 
> hmm, I don't see this one in net branch, should i resubmit via my queue? 

It's there:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c749e3f82a15e10a798bb55f60368ee102c793cb

But keep in mind that master is gone (long live main).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-24  0:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22  9:06 [PATCH net v1] net/mlx5: Fix memory leak in IPsec RoCE creation Leon Romanovsky
2023-02-23 10:30 ` patchwork-bot+netdevbpf
2023-02-23 22:49   ` Saeed Mahameed
2023-02-24  0:14     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).