From: Dotan Barak Date: Thu, 29 May 2014 13:30:59 +0000 (+0300) Subject: mlx4_core: Fix memory leaks in SR-IOV error paths X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b38f2879b7d2d51747de2ea9062c698a6ac64cb1;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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: Dotan Barak Signed-off-by: Jack Morgenstein Signed-off-by: Or Gerlitz Signed-off-by: Roland Dreier --- diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 7cf9dadcb471..12a7ee2e6098 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -1696,6 +1696,13 @@ unmap_bf: unmap_internal_clock(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: if (mlx4_is_slave(dev)) mlx4_slave_exit(dev); @@ -2565,6 +2572,13 @@ err_master_mfunc: if (mlx4_is_master(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: if (dev->flags & MLX4_FLAG_MSI_X) pci_disable_msix(pdev);