Commit b38f2879 authored by Dotan Barak's avatar Dotan Barak Committed by Roland Dreier

mlx4_core: Fix memory leaks in SR-IOV error paths

Fix a few memory leaks that happen if errors happen in SR-IOV mode.
Signed-off-by: default avatarDotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent bfdfcfee
...@@ -1696,6 +1696,13 @@ static int mlx4_init_hca(struct mlx4_dev *dev) ...@@ -1696,6 +1696,13 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
unmap_internal_clock(dev); unmap_internal_clock(dev);
unmap_bf_area(dev); unmap_bf_area(dev);
if (mlx4_is_slave(dev)) {
kfree(dev->caps.qp0_tunnel);
kfree(dev->caps.qp0_proxy);
kfree(dev->caps.qp1_tunnel);
kfree(dev->caps.qp1_proxy);
}
err_close: err_close:
if (mlx4_is_slave(dev)) if (mlx4_is_slave(dev))
mlx4_slave_exit(dev); mlx4_slave_exit(dev);
...@@ -2565,6 +2572,13 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) ...@@ -2565,6 +2572,13 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
if (mlx4_is_master(dev)) if (mlx4_is_master(dev))
mlx4_multi_func_cleanup(dev); mlx4_multi_func_cleanup(dev);
if (mlx4_is_slave(dev)) {
kfree(dev->caps.qp0_tunnel);
kfree(dev->caps.qp0_proxy);
kfree(dev->caps.qp1_tunnel);
kfree(dev->caps.qp1_proxy);
}
err_close: err_close:
if (dev->flags & MLX4_FLAG_MSI_X) if (dev->flags & MLX4_FLAG_MSI_X)
pci_disable_msix(pdev); pci_disable_msix(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment