From mboxrd@z Thu Jan 1 00:00:00 1970 From: Raslan Darawsheh Subject: [PATCH v2 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Date: Mon, 7 May 2018 18:10:32 +0300 Message-ID: <1525705833-8573-1-git-send-email-rasland@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: dev@dpdk.org, thomas@monjalon.net, ophirmu@mellanox.com, rasland@mellanox.com, stable@dpdk.org To: shahafs@mellanox.com Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When attr_ctx is NULL it will attempt to free the list of devices twice. Avoid double freeing the list by directly going to error handling. Fixes: 771fa900 ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh --- v2 changes: Better handle for switch statement. Reword the commit log. --- --- drivers/net/mlx5/mlx5.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 5190b9f..3831e3d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -690,18 +690,18 @@ 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, "cannot access device, is mlx5_ib loaded?"); err = ENODEV; - goto error; + break; case EINVAL: DRV_LOG(ERR, "cannot use device, are drivers up to date?"); - goto error; + break; } + goto error; } ibv_dev = list[i]; DRV_LOG(DEBUG, "device opened"); -- 2.7.4