DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling
@ 2018-05-08  9:11 Raslan Darawsheh
  2018-05-08  9:11 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error Raslan Darawsheh
  2018-05-08 19:08 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Yongseok Koh
  0 siblings, 2 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2018-05-08  9:11 UTC (permalink / raw)
  To: shahafs; +Cc: dev, thomas, ophirmu, rasland, yskoh, stable

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: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

---
v2 changes:
 Better handle for switch statement.
 Reword the commit log.

v3 changes:
 Reword the commit log title.
 add more figures to the Fixes commit
---
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error
  2018-05-08  9:11 [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Raslan Darawsheh
@ 2018-05-08  9:11 ` Raslan Darawsheh
  2018-05-08 19:19   ` Yongseok Koh
  2018-05-08 19:08 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Yongseok Koh
  1 sibling, 1 reply; 6+ messages in thread
From: Raslan Darawsheh @ 2018-05-08  9:11 UTC (permalink / raw)
  To: shahafs; +Cc: dev, thomas, ophirmu, rasland, yskoh, stable

If something went wrong in mlx5 pci prop 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 <rasland@mellanox.com>

---
v2 changes:
 Reword the commit log.

v3 changes:
 Reword the commit log.
 change the release to be only in primary process.
---
---
 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 3831e3d..c4ab166 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1063,6 +1063,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			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.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling
  2018-05-08  9:11 [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Raslan Darawsheh
  2018-05-08  9:11 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error Raslan Darawsheh
@ 2018-05-08 19:08 ` Yongseok Koh
  2018-05-09  9:51   ` Shahaf Shuler
  1 sibling, 1 reply; 6+ messages in thread
From: Yongseok Koh @ 2018-05-08 19:08 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: Shahaf Shuler, dev, Thomas Monjalon, Ophir Munk, stable


> On May 8, 2018, at 2:11 AM, Raslan Darawsheh <rasland@mellanox.com> wrote:
> 
> 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: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error
  2018-05-08  9:11 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error Raslan Darawsheh
@ 2018-05-08 19:19   ` Yongseok Koh
  2018-05-09  9:50     ` Shahaf Shuler
  0 siblings, 1 reply; 6+ messages in thread
From: Yongseok Koh @ 2018-05-08 19:19 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: Shahaf Shuler, dev, Thomas Monjalon, Ophir Munk, stable


> On May 8, 2018, at 2:11 AM, Raslan Darawsheh <rasland@mellanox.com> wrote:
> 
> If something went wrong in mlx5 pci prop 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 <rasland@mellanox.com>
> 
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error
  2018-05-08 19:19   ` Yongseok Koh
@ 2018-05-09  9:50     ` Shahaf Shuler
  0 siblings, 0 replies; 6+ messages in thread
From: Shahaf Shuler @ 2018-05-09  9:50 UTC (permalink / raw)
  To: Yongseok Koh, Raslan Darawsheh; +Cc: dev, Thomas Monjalon, Ophir Munk, stable



--Shahaf


> -----Original Message-----
> From: Yongseok Koh
> Sent: Tuesday, May 8, 2018 10:20 PM
> To: Raslan Darawsheh <rasland@mellanox.com>
> Cc: Shahaf Shuler <shahafs@mellanox.com>; dev@dpdk.org; Thomas
> Monjalon <thomas@monjalon.net>; Ophir Munk
> <ophirmu@mellanox.com>; stable@dpdk.org
> Subject: Re: [PATCH v3 2/2] net/mlx5: fix resource leak in case of error
> 
> 
> > On May 8, 2018, at 2:11 AM, Raslan Darawsheh <rasland@mellanox.com>
> wrote:
> >
> > If something went wrong in mlx5 pci prop the allocated eth dev will
> > cause a memory leak.
> >
> > This commit release the eth dev that was previously allocated.

Considering this patch as a temporary w.a. as there is patchset[1] which starts to address this issue from ethdev layer.

> >
> > Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox
> > ConnectX-4 adapters")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> >
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> 
> Thanks


[1]
http://dpdk.org/dev/patchwork/patch/39544/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling
  2018-05-08 19:08 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Yongseok Koh
@ 2018-05-09  9:51   ` Shahaf Shuler
  0 siblings, 0 replies; 6+ messages in thread
From: Shahaf Shuler @ 2018-05-09  9:51 UTC (permalink / raw)
  To: Yongseok Koh, Raslan Darawsheh; +Cc: dev, Thomas Monjalon, Ophir Munk, stable

Tuesday, May 8, 2018 10:09 PM, Yongseok Koh:
> Subject: Re: [PATCH v3 1/2] net/mlx5: fix double free on error handling
> 
> 
> > On May 8, 2018, at 2:11 AM, Raslan Darawsheh <rasland@mellanox.com>
> wrote:
> >
> > 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: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4
> adapters")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> 
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Series applied to next-net-mlx, thanks. 

> 
> Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-09  9:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08  9:11 [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Raslan Darawsheh
2018-05-08  9:11 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix resource leak in case of error Raslan Darawsheh
2018-05-08 19:19   ` Yongseok Koh
2018-05-09  9:50     ` Shahaf Shuler
2018-05-08 19:08 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling Yongseok Koh
2018-05-09  9:51   ` Shahaf Shuler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).