From 690de2850b26466ad5325fde3e1aff040e3868f8 Mon Sep 17 00:00:00 2001 From: Raslan Darawsheh Date: Tue, 8 May 2018 12:11:27 +0300 Subject: [PATCH] net/mlx5: fix resource leak in case of error 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@dpdk.org Signed-off-by: Raslan Darawsheh Acked-by: Yongseok Koh --- 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 05d4f024a9..fcb14fe1a2 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1063,6 +1063,8 @@ port_error: claim_zero(mlx5_glue->dealloc_pd(pd)); if (ctx) claim_zero(mlx5_glue->close_device(ctx)); + if (eth_dev && rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_eth_dev_release_port(eth_dev); break; } /* -- 2.20.1