[dpdk-stable] patch 'net/tap: fix mbuf and mem leak during queue release' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Thu May 28 18:23:06 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.9

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

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3

Thanks.

Kevin.

---
>From 19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3 Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Thu, 16 Apr 2020 11:04:25 +0800
Subject: [PATCH] net/tap: fix mbuf and mem leak during queue release

[ upstream commit 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 ]

For the tap PMD, we should release mbufs and iovecs from the Rx queue
when closing device. In order to remove duplicated code,
rte_pmd_tap_remove() calls tap_dev_close().

Fixes: 0781f5762cfe ("net/tap: support segmented mbufs")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 36 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7b3954621e..c6cfb4c683 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1008,13 +1008,23 @@ tap_dev_close(struct rte_eth_dev *dev)
 	struct pmd_internals *internals = dev->data->dev_private;
 	struct pmd_process_private *process_private = dev->process_private;
+	struct rx_queue *rxq;
 
 	tap_link_set_down(dev);
-	tap_flow_flush(dev, NULL);
-	tap_flow_implicit_flush(internals, NULL);
+	if (internals->nlsk_fd != -1) {
+		tap_flow_flush(dev, NULL);
+		tap_flow_implicit_flush(internals, NULL);
+		tap_nl_final(internals->nlsk_fd);
+		internals->nlsk_fd = -1;
+	}
 
 	for (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) {
 		if (process_private->rxq_fds[i] != -1) {
+			rxq = &internals->rxq[i];
 			close(process_private->rxq_fds[i]);
 			process_private->rxq_fds[i] = -1;
+			rte_pktmbuf_free(rxq->pool);
+			rte_free(rxq->iovecs);
+			rxq->pool = NULL;
+			rxq->iovecs = NULL;
 		}
 		if (process_private->txq_fds[i] != -1) {
@@ -2291,6 +2301,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
 	struct rte_eth_dev *eth_dev = NULL;
 	struct pmd_internals *internals;
-	struct pmd_process_private *process_private;
-	int i;
 
 	/* find the ethdev entry */
@@ -2305,27 +2313,11 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
 		return rte_eth_dev_release_port(eth_dev);
 
+	tap_dev_close(eth_dev);
+
 	internals = eth_dev->data->dev_private;
-	process_private = eth_dev->process_private;
-
 	TAP_LOG(DEBUG, "Closing %s Ethernet device on numa %u",
 		(internals->type == ETH_TUNTAP_TYPE_TAP) ? "TAP" : "TUN",
 		rte_socket_id());
 
-	if (internals->nlsk_fd) {
-		tap_flow_flush(eth_dev, NULL);
-		tap_flow_implicit_flush(internals, NULL);
-		tap_nl_final(internals->nlsk_fd);
-	}
-	for (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) {
-		if (process_private->rxq_fds[i] != -1) {
-			close(process_private->rxq_fds[i]);
-			process_private->rxq_fds[i] = -1;
-		}
-		if (process_private->txq_fds[i] != -1) {
-			close(process_private->txq_fds[i]);
-			process_private->txq_fds[i] = -1;
-		}
-	}
-
 	close(internals->ioctl_sock);
 	rte_free(eth_dev->process_private);
-- 
2.21.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-28 17:13:03.194480912 +0100
+++ 0079-net-tap-fix-mbuf-and-mem-leak-during-queue-release.patch	2020-05-28 17:12:59.164554975 +0100
@@ -1 +1 @@
-From 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 Mon Sep 17 00:00:00 2001
+From 19bab2b4d6b9be326eb04f84eebd09de4d5ebdc3 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 710aa4279097e9ee5a131b7e0732e5a8ef8bcfc1 ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 6d54c254d7..9c88b9268e 100644
+index 7b3954621e..c6cfb4c683 100644
@@ -24 +25 @@
-@@ -1021,13 +1021,23 @@ tap_dev_close(struct rte_eth_dev *dev)
+@@ -1008,13 +1008,23 @@ tap_dev_close(struct rte_eth_dev *dev)
@@ -50 +51 @@
-@@ -2399,6 +2409,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
+@@ -2291,6 +2301,4 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
@@ -57 +58 @@
-@@ -2413,26 +2421,10 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
+@@ -2305,27 +2313,11 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
@@ -66 +67,2 @@
- 		tuntap_types[internals->type], rte_socket_id());
+ 		(internals->type == ETH_TUNTAP_TYPE_TAP) ? "TAP" : "TUN",
+ 		rte_socket_id());



More information about the stable mailing list