[dpdk-stable] patch 'net/tap: fix cleanup on allocation failure' has been queued to LTS release 17.11.1

Yuanhan Liu yliu at fridaylinux.org
Sun Feb 11 05:02:47 CET 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/13/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 344d489593d878837c45815ba5b8cf3ef5689826 Mon Sep 17 00:00:00 2001
From: Moti Haimovsky <motih at mellanox.com>
Date: Mon, 5 Feb 2018 18:17:20 +0200
Subject: [PATCH] net/tap: fix cleanup on allocation failure

[ upstream commit cb7e68da630abe7bb7b69885cc2a1a8e6d705943 ]

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

Signed-off-by: Moti Haimovsky <motih at mellanox.com>
Acked-by: Pascal Mazon <pascal.mazon at 6wind.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 036028f..b8187f9 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1240,13 +1240,13 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
 	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;
@@ -1416,6 +1416,11 @@ error_remote:
 	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));
 
-- 
2.7.4



More information about the stable mailing list