[10/14] tap: close netlink socket on device close
diff mbox series

Message ID 20200104013341.19809-11-stephen@networkplumber.org
State Deferred
Delegated to: David Marchand
Headers show
Series
  • cleanup resources on shutdown
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 4, 2020, 1:33 a.m. UTC
The netlink socket for flow creation was left open and never
closed.

Fixes: bf7b7f437b49 ("net/tap: create netdevice during probing")
Cc: pascal.mazon@6wind.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index a13d8d50d7d7..d293dd8eeed5 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1035,6 +1035,11 @@  tap_dev_close(struct rte_eth_dev *dev)
 				&internals->remote_initial_flags);
 	}
 
+	if (internals->nlsk_fd != -1) {
+		close(internals->nlsk_fd);
+		internals->nlsk_fd = -1;
+	}
+
 	if (internals->ka_fd != -1) {
 		close(internals->ka_fd);
 		internals->ka_fd = -1;
@@ -2406,7 +2411,7 @@  rte_pmd_tap_remove(struct rte_vdev_device *dev)
 	TAP_LOG(DEBUG, "Closing %s Ethernet device on numa %u",
 		tuntap_types[internals->type], rte_socket_id());
 
-	if (internals->nlsk_fd) {
+	if (internals->nlsk_fd != -1) {
 		tap_flow_flush(eth_dev, NULL);
 		tap_flow_implicit_flush(internals, NULL);
 		tap_nl_final(internals->nlsk_fd);