[dpdk-stable] patch 'net/pcap: fix file descriptor leak on close' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Mon May 10 17:59:31 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/44e87e7c102af00f688992b09487b1dd33c47506

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 44e87e7c102af00f688992b09487b1dd33c47506 Mon Sep 17 00:00:00 2001
From: Tengfei Zhang <zypscode at outlook.com>
Date: Tue, 2 Mar 2021 16:51:30 +0000
Subject: [PATCH] net/pcap: fix file descriptor leak on close
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit e412a138db918019cbd883132f81860951515a9b ]

pcap fd was opend when vdev probed,
but not closed when vdev removed.

Fixes: c956caa6eabf ("pcap: support port hotplug")

Signed-off-by: Tengfei Zhang <zypscode at outlook.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/pcap/rte_eth_pcap.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 14a0072d86..da4dfe799e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -621,9 +621,11 @@ eth_dev_stop(struct rte_eth_dev *dev)
 
 	/* Special iface case. Single pcap is open and shared between tx/rx. */
 	if (internals->single_iface) {
-		pcap_close(pp->tx_pcap[0]);
-		pp->tx_pcap[0] = NULL;
-		pp->rx_pcap[0] = NULL;
+		if (pp->tx_pcap[0] != NULL) {
+			pcap_close(pp->tx_pcap[0]);
+			pp->tx_pcap[0] = NULL;
+			pp->rx_pcap[0] = NULL;
+		}
 		goto status_down;
 	}
 
@@ -755,6 +757,8 @@ eth_dev_close(struct rte_eth_dev *dev)
 	PMD_LOG(INFO, "Closing pcap ethdev on NUMA socket %d",
 			rte_socket_id());
 
+	eth_dev_stop(dev);
+
 	rte_free(dev->process_private);
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-05-10 23:59:27.284370200 +0800
+++ 0023-net-pcap-fix-file-descriptor-leak-on-close.patch	2021-05-10 23:59:26.350000000 +0800
@@ -1 +1 @@
-From e412a138db918019cbd883132f81860951515a9b Mon Sep 17 00:00:00 2001
+From 44e87e7c102af00f688992b09487b1dd33c47506 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit e412a138db918019cbd883132f81860951515a9b ]
@@ -10 +12,0 @@
-Cc: stable at dpdk.org
@@ -19 +21 @@
-index 2766745a71..28a5027315 100644
+index 14a0072d86..da4dfe799e 100644
@@ -22 +24,2 @@
-@@ -682,9 +682,11 @@ eth_dev_stop(struct rte_eth_dev *dev)
+@@ -621,9 +621,11 @@ eth_dev_stop(struct rte_eth_dev *dev)
+ 
@@ -25 +27,0 @@
- 		queue_missed_stat_on_stop_update(dev, 0);
@@ -37 +39 @@
-@@ -821,6 +823,8 @@ eth_dev_close(struct rte_eth_dev *dev)
+@@ -755,6 +757,8 @@ eth_dev_close(struct rte_eth_dev *dev)


More information about the stable mailing list