mirror of https://gitee.com/openkylin/linux.git
net/mlx4_core: Fix to clean devlink resources
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: 09d4d087cd
("mlx4: Implement devlink interface")
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7932aa1e43
commit
fba1296624
|
@ -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);
|
mlx4_err(dev, "Failed to create mtu file for port %d\n", port);
|
||||||
device_remove_file(&info->dev->persist->pdev->dev,
|
device_remove_file(&info->dev->persist->pdev->dev,
|
||||||
&info->port_attr);
|
&info->port_attr);
|
||||||
|
devlink_port_unregister(&info->devlink_port);
|
||||||
info->port = -1;
|
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_attr);
|
||||||
device_remove_file(&info->dev->persist->pdev->dev,
|
device_remove_file(&info->dev->persist->pdev->dev,
|
||||||
&info->port_mtu_attr);
|
&info->port_mtu_attr);
|
||||||
|
devlink_port_unregister(&info->devlink_port);
|
||||||
|
|
||||||
#ifdef CONFIG_RFS_ACCEL
|
#ifdef CONFIG_RFS_ACCEL
|
||||||
free_irq_cpu_rmap(info->rmap);
|
free_irq_cpu_rmap(info->rmap);
|
||||||
info->rmap = NULL;
|
info->rmap = NULL;
|
||||||
|
|
Loading…
Reference in New Issue