* [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL
@ 2018-05-07 12:18 Raslan Darawsheh
2018-05-07 12:18 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add free for eth dev port in case of error Raslan Darawsheh
2018-05-07 17:14 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Yongseok Koh
0 siblings, 2 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2018-05-07 12:18 UTC (permalink / raw)
To: shahafs; +Cc: dev, thomas, ophirmu, rasland, stable
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(-)
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];
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/mlx5: add free for eth dev port in case of error
2018-05-07 12:18 [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Raslan Darawsheh
@ 2018-05-07 12:18 ` Raslan Darawsheh
2018-05-07 17:14 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Yongseok Koh
1 sibling, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2018-05-07 12:18 UTC (permalink / raw)
To: shahafs; +Cc: dev, thomas, ophirmu, rasland
in case of errors need to free the eth_dev port that was allocated
during the port setup.
Signed-off-by: Raslan Darawsheh <rasland@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 d34076b..63c94ad 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1064,6 +1064,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_eth_dev_release_port(eth_dev);
break;
}
/*
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL
2018-05-07 12:18 [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Raslan Darawsheh
2018-05-07 12:18 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add free for eth dev port in case of error Raslan Darawsheh
@ 2018-05-07 17:14 ` Yongseok Koh
2018-05-07 17:22 ` Raslan Darawsheh
1 sibling, 1 reply; 4+ messages in thread
From: Yongseok Koh @ 2018-05-07 17:14 UTC (permalink / raw)
To: Raslan Darawsheh; +Cc: Shahaf Shuler, dev, Thomas Monjalon, Ophir Munk, stable
> On May 7, 2018, at 5:18 AM, Raslan Darawsheh <rasland@mellanox.com> wrote:
Please don't use PMD/code specific words in the title. I suggest:
net/mlx5: fix double free on error handling
> 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")
Prefer to put 12 figures?
> Cc: stable@dpdk.org
New line here.
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
> drivers/net/mlx5/mlx5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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];
> --
Nice catch!
Looks the goto lines are redundant. How about this instead?
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 5190b9fcd..270f59b27 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -690,18 +690,16 @@ 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;
case EINVAL:
DRV_LOG(ERR,
"cannot use device, are drivers up to date?");
- goto error;
}
+ goto error;
}
ibv_dev = list[i];
DRV_LOG(DEBUG, "device opened");
Thanks,
Yongseok
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL
2018-05-07 17:14 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Yongseok Koh
@ 2018-05-07 17:22 ` Raslan Darawsheh
0 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2018-05-07 17:22 UTC (permalink / raw)
To: Yongseok Koh; +Cc: Shahaf Shuler, dev, Thomas Monjalon, Ophir Munk, stable
Hi Yongseok,
Thx for your review.
But I already sent a V2 for this patch which handles the redundant goto that I had.
But still missing the fix for title.
I'll submit a v3 tomorrow with a fixed title.
Kindest regards
Raslan Darawsheh
________________________________
From: Yongseok Koh
Sent: Monday, May 7, 2018 8:14:22 PM
To: Raslan Darawsheh
Cc: Shahaf Shuler; dev@dpdk.org; Thomas Monjalon; Ophir Munk; stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL
> On May 7, 2018, at 5:18 AM, Raslan Darawsheh <rasland@mellanox.com> wrote:
Please don't use PMD/code specific words in the title. I suggest:
net/mlx5: fix double free on error handling
> 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")
Prefer to put 12 figures?
> Cc: stable@dpdk.org
New line here.
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
> drivers/net/mlx5/mlx5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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];
> --
Nice catch!
Looks the goto lines are redundant. How about this instead?
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 5190b9fcd..270f59b27 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -690,18 +690,16 @@ 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;
case EINVAL:
DRV_LOG(ERR,
"cannot use device, are drivers up to date?");
- goto error;
}
+ goto error;
}
ibv_dev = list[i];
DRV_LOG(DEBUG, "device opened");
Thanks,
Yongseok
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-07 17:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 12:18 [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Raslan Darawsheh
2018-05-07 12:18 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add free for eth dev port in case of error Raslan Darawsheh
2018-05-07 17:14 ` [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Yongseok Koh
2018-05-07 17:22 ` Raslan Darawsheh
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).