All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
@ 2020-12-21 11:27 Dinghao Liu
  2020-12-27  8:33 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-12-21 11:27 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski,
	netdev, linux-rdma, linux-kernel

When mlx5_create_flow_group() fails, ft->g should be
freed just like when kvzalloc() fails. The caller of
mlx5e_create_l2_table_groups() does not catch this
issue on failure, which leads to memleak.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
index fa8149f6eb08..72de1009b104 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -1390,6 +1390,7 @@ static int mlx5e_create_l2_table_groups(struct mlx5e_l2_table *l2_table)
 	ft->g[ft->num_groups] = NULL;
 	mlx5e_destroy_groups(ft);
 	kvfree(in);
+	kfree(ft->g);
 
 	return err;
 }
-- 
2.17.1


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

* Re: [PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
  2020-12-21 11:27 [PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Dinghao Liu
@ 2020-12-27  8:33 ` Leon Romanovsky
  2021-01-05 21:04   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2020-12-27  8:33 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Saeed Mahameed, David S. Miller, Jakub Kicinski, netdev,
	linux-rdma, linux-kernel

On Mon, Dec 21, 2020 at 07:27:31PM +0800, Dinghao Liu wrote:
> When mlx5_create_flow_group() fails, ft->g should be
> freed just like when kvzalloc() fails. The caller of
> mlx5e_create_l2_table_groups() does not catch this
> issue on failure, which leads to memleak.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 +
>  1 file changed, 1 insertion(+)
>

Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table")

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
  2020-12-27  8:33 ` Leon Romanovsky
@ 2021-01-05 21:04   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2021-01-05 21:04 UTC (permalink / raw)
  To: Leon Romanovsky, Dinghao Liu
  Cc: kjlu, David S. Miller, Jakub Kicinski, netdev, linux-rdma, linux-kernel

On Sun, 2020-12-27 at 10:33 +0200, Leon Romanovsky wrote:
> On Mon, Dec 21, 2020 at 07:27:31PM +0800, Dinghao Liu wrote:
> > When mlx5_create_flow_group() fails, ft->g should be
> > freed just like when kvzalloc() fails. The caller of
> > mlx5e_create_l2_table_groups() does not catch this
> > issue on failure, which leads to memleak.
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >  drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> 
> Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table")
> 
Added

> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

Applied to net-mlx5
Thanks



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

end of thread, other threads:[~2021-01-05 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 11:27 [PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Dinghao Liu
2020-12-27  8:33 ` Leon Romanovsky
2021-01-05 21:04   ` Saeed Mahameed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.