[dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd

wangyunjian wangyunjian at huawei.com
Tue Apr 7 06:23:26 CEST 2020


From: Yunjian Wang <wangyunjian at huawei.com>

The internals is freed and setted NULL in the rte_eth_dev_release_port()
and zero is a valid fd. As a result, a valid fd is incorrectly closed.

Fixes: 3101191c63ab ("net/tap: fix device removal when no queue exist")
CC: stable at dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
---
 drivers/net/tap/rte_eth_tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 703fcceb9..88cd615e0 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2468,12 +2468,12 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
 	if (tap_devices_count == 1)
 		rte_mp_action_unregister(TAP_MP_KEY);
 	tap_devices_count--;
-	rte_eth_dev_release_port(eth_dev);
 
 	if (internals->ka_fd != -1) {
 		close(internals->ka_fd);
 		internals->ka_fd = -1;
 	}
+	rte_eth_dev_release_port(eth_dev);
 	return 0;
 }
 
-- 
2.19.1




More information about the dev mailing list