netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/mlx4_core: Fix to clean devlink resources
@ 2016-09-20 11:55 Tariq Toukan
  2016-09-22  5:41 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2016-09-20 11:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Kamal Heib, Tariq Toukan

From: Kamal Heib <kamalh@mellanox.com>

This patch cleans devlink resources by calling devlink_port_unregister()
to avoid the following issues:

- Kernel panic when triggering reset flow.
- Memory leak due to unfreed resources in mlx4_init_port_info().

Fixes: 09d4d087cd48 ("mlx4: Implement devlink interface")
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
Please push it to -stable  >= 4.6 as well. Thanks.

 drivers/net/ethernet/mellanox/mlx4/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 75dd2e3d3059..7183ac4135d2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2970,6 +2970,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
 		mlx4_err(dev, "Failed to create mtu file for port %d\n", port);
 		device_remove_file(&info->dev->persist->pdev->dev,
 				   &info->port_attr);
+		devlink_port_unregister(&info->devlink_port);
 		info->port = -1;
 	}
 
@@ -2984,6 +2985,8 @@ static void mlx4_cleanup_port_info(struct mlx4_port_info *info)
 	device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr);
 	device_remove_file(&info->dev->persist->pdev->dev,
 			   &info->port_mtu_attr);
+	devlink_port_unregister(&info->devlink_port);
+
 #ifdef CONFIG_RFS_ACCEL
 	free_irq_cpu_rmap(info->rmap);
 	info->rmap = NULL;
-- 
1.8.3.1

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

* Re: [PATCH net] net/mlx4_core: Fix to clean devlink resources
  2016-09-20 11:55 [PATCH net] net/mlx4_core: Fix to clean devlink resources Tariq Toukan
@ 2016-09-22  5:41 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-09-22  5:41 UTC (permalink / raw)
  To: tariqt; +Cc: netdev, eranbe, kamalh

From: Tariq Toukan <tariqt@mellanox.com>
Date: Tue, 20 Sep 2016 14:55:31 +0300

> From: Kamal Heib <kamalh@mellanox.com>
> 
> This patch cleans devlink resources by calling devlink_port_unregister()
> to avoid the following issues:
> 
> - Kernel panic when triggering reset flow.
> - Memory leak due to unfreed resources in mlx4_init_port_info().
> 
> Fixes: 09d4d087cd48 ("mlx4: Implement devlink interface")
> Signed-off-by: Kamal Heib <kamalh@mellanox.com>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> ---
> Please push it to -stable  >= 4.6 as well. Thanks.

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2016-09-22  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20 11:55 [PATCH net] net/mlx4_core: Fix to clean devlink resources Tariq Toukan
2016-09-22  5:41 ` David Miller

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).