[dpdk-dev,1/2] net/mlx5: fix multiple free issue when attr ctx is NULL

Message ID 1525695534-15072-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Raslan Darawsheh May 7, 2018, 12:18 p.m. UTC
  When attr_ctx is NULL it will attempt to free the list of devices twice.
So, changing it to be freed in error handling only.

Fixes: 771fa900 ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 5190b9f..d34076b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -690,7 +690,6 @@  mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		break;
 	}
 	if (attr_ctx == NULL) {
-		mlx5_glue->free_device_list(list);
 		switch (err) {
 		case 0:
 			DRV_LOG(ERR,
@@ -701,6 +700,8 @@  mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			DRV_LOG(ERR,
 				"cannot use device, are drivers up to date?");
 			goto error;
+		default:
+			goto error;
 		}
 	}
 	ibv_dev = list[i];