DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/tap: fix res cleanup when tap create fails
@ 2018-02-05 16:17 Moti Haimovsky
  2018-02-07 16:00 ` Pascal Mazon
  0 siblings, 1 reply; 3+ messages in thread
From: Moti Haimovsky @ 2018-02-05 16:17 UTC (permalink / raw)
  To: pascal.mazon; +Cc: dev, Moti Haimovsky, stable

This patch complements the partial cleanup done inside
eth_dev_tap_create when the routine failed.
Such a failure left a non-functional device attached to the system.

Fixes: 050fe6e9ff97 ("drivers/net: use ethdev allocation helper for vdev")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
 drivers/net/tap/rte_eth_tap.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index dc3847e..8931dec 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1347,13 +1347,13 @@ enum ioctl_mode {
 	data = rte_zmalloc_socket(tap_name, sizeof(*data), 0, numa_node);
 	if (!data) {
 		RTE_LOG(ERR, PMD, "TAP Failed to allocate data\n");
-		goto error_exit;
+		goto error_exit_nodev;
 	}
 
 	dev = rte_eth_vdev_allocate(vdev, sizeof(*pmd));
 	if (!dev) {
 		RTE_LOG(ERR, PMD, "TAP Unable to allocate device struct\n");
-		goto error_exit;
+		goto error_exit_nodev;
 	}
 
 	pmd = dev->data->dev_private;
@@ -1524,6 +1524,11 @@ enum ioctl_mode {
 	tap_flow_implicit_flush(pmd, NULL);
 
 error_exit:
+	if (pmd->ioctl_sock > 0)
+		close(pmd->ioctl_sock);
+	rte_eth_dev_release_port(dev);
+
+error_exit_nodev:
 	RTE_LOG(ERR, PMD, "TAP Unable to initialize %s\n",
 		rte_vdev_device_name(vdev));
 
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/tap: fix res cleanup when tap create fails
  2018-02-05 16:17 [dpdk-dev] [PATCH] net/tap: fix res cleanup when tap create fails Moti Haimovsky
@ 2018-02-07 16:00 ` Pascal Mazon
  2018-02-08 12:28   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal Mazon @ 2018-02-07 16:00 UTC (permalink / raw)
  To: Moti Haimovsky; +Cc: dev, stable

Acked-by: Pascal Mazon <pascal.mazon@6wind.com>

On 05/02/2018 17:17, Moti Haimovsky wrote:
> This patch complements the partial cleanup done inside
> eth_dev_tap_create when the routine failed.
> Such a failure left a non-functional device attached to the system.
>
> Fixes: 050fe6e9ff97 ("drivers/net: use ethdev allocation helper for vdev")
> Cc: stable@dpdk.org
>
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> ---
>  drivers/net/tap/rte_eth_tap.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index dc3847e..8931dec 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1347,13 +1347,13 @@ enum ioctl_mode {
>  	data = rte_zmalloc_socket(tap_name, sizeof(*data), 0, numa_node);
>  	if (!data) {
>  		RTE_LOG(ERR, PMD, "TAP Failed to allocate data\n");
> -		goto error_exit;
> +		goto error_exit_nodev;
>  	}
>  
>  	dev = rte_eth_vdev_allocate(vdev, sizeof(*pmd));
>  	if (!dev) {
>  		RTE_LOG(ERR, PMD, "TAP Unable to allocate device struct\n");
> -		goto error_exit;
> +		goto error_exit_nodev;
>  	}
>  
>  	pmd = dev->data->dev_private;
> @@ -1524,6 +1524,11 @@ enum ioctl_mode {
>  	tap_flow_implicit_flush(pmd, NULL);
>  
>  error_exit:
> +	if (pmd->ioctl_sock > 0)
> +		close(pmd->ioctl_sock);
> +	rte_eth_dev_release_port(dev);
> +
> +error_exit_nodev:
>  	RTE_LOG(ERR, PMD, "TAP Unable to initialize %s\n",
>  		rte_vdev_device_name(vdev));
>  

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/tap: fix res cleanup when tap create fails
  2018-02-07 16:00 ` Pascal Mazon
@ 2018-02-08 12:28   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-02-08 12:28 UTC (permalink / raw)
  To: Pascal Mazon, Moti Haimovsky; +Cc: dev, stable

On 2/7/2018 4:00 PM, Pascal Mazon wrote:

> On 05/02/2018 17:17, Moti Haimovsky wrote:
>> This patch complements the partial cleanup done inside
>> eth_dev_tap_create when the routine failed.
>> Such a failure left a non-functional device attached to the system.
>>
>> Fixes: 050fe6e9ff97 ("drivers/net: use ethdev allocation helper for vdev")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
>
> Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2018-02-08 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 16:17 [dpdk-dev] [PATCH] net/tap: fix res cleanup when tap create fails Moti Haimovsky
2018-02-07 16:00 ` Pascal Mazon
2018-02-08 12:28   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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).