[dpdk-stable] [PATCH v2 59/67] net/mlx5: fix resource leak in case	of error
    Yongseok Koh 
    yskoh at mellanox.com
       
    Tue Jun  5 02:40:29 CEST 2018
    
    
  
From: Raslan Darawsheh <rasland at mellanox.com>
[ backported from upstream commit 690de2850b26466ad5325fde3e1aff040e3868f8 ]
If something went wrong in mlx5_pci_prob the allocated eth dev
will cause a memory leak.
This commit release the eth dev that was previously allocated.
Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable at dpdk.org
Signed-off-by: Raslan Darawsheh <rasland at mellanox.com>
Acked-by: Yongseok Koh <yskoh at mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ef17ec9a1..bb56bd22d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1089,6 +1089,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			claim_zero(ibv_dealloc_pd(pd));
 		if (ctx)
 			claim_zero(ibv_close_device(ctx));
+		if (eth_dev && rte_eal_process_type() == RTE_PROC_PRIMARY)
+			rte_eth_dev_release_port(eth_dev);
 		break;
 	}
 	/*
-- 
2.11.0
    
    
More information about the stable
mailing list