[dpdk-stable] patch 'net/pcap: fix resource leakage on port probe' has been queued to stable release 20.11.4
Xueming Li
xuemingl at nvidia.com
Wed Nov 10 07:28:38 CET 2021
Hi,
FYI, your patch has been queued to stable release 20.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/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/6b6aacee7102439684c272bd1513eff6e70cdffd
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 6b6aacee7102439684c272bd1513eff6e70cdffd Mon Sep 17 00:00:00 2001
From: Qiming Chen <chenqiming_huawei at 163.com>
Date: Mon, 30 Aug 2021 11:01:08 +0800
Subject: [PATCH] net/pcap: fix resource leakage on port probe
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit da0280b3a34c6f67f7e558fcc86c3110816fea28 ]
When the port is probed, if the eth_from_pcaps function fails, the
previously opened pcap resources are not released, causing resource
leakage.
The patch solves the problem of resource leakage caused by abnormal
branch exit during the port probe process.
Fixes: 4c173302c307 ("pcap: add new driver")
Signed-off-by: Qiming Chen <chenqiming_huawei at 163.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
drivers/net/pcap/rte_eth_pcap.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index da4dfe799e..2e8ac55b72 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1366,6 +1366,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev,
return 0;
}
+static void
+eth_release_pcaps(struct pmd_devargs *pcaps,
+ struct pmd_devargs *dumpers,
+ int single_iface)
+{
+ unsigned int i;
+
+ if (single_iface) {
+ if (pcaps->queue[0].pcap)
+ pcap_close(pcaps->queue[0].pcap);
+ return;
+ }
+
+ for (i = 0; i < dumpers->num_of_queue; i++) {
+ if (dumpers->queue[i].dumper)
+ pcap_dump_close(dumpers->queue[i].dumper);
+
+ if (dumpers->queue[i].pcap)
+ pcap_close(dumpers->queue[i].pcap);
+ }
+
+ for (i = 0; i < pcaps->num_of_queue; i++) {
+ if (pcaps->queue[i].pcap)
+ pcap_close(pcaps->queue[i].pcap);
+ }
+}
+
static int
pmd_pcap_probe(struct rte_vdev_device *dev)
{
@@ -1586,6 +1613,9 @@ create_eth:
free_kvlist:
rte_kvargs_free(kvlist);
+ if (ret < 0)
+ eth_release_pcaps(&pcaps, &dumpers, devargs_all.single_iface);
+
return ret;
}
--
2.33.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2021-11-10 14:17:03.635612892 +0800
+++ 0034-net-pcap-fix-resource-leakage-on-port-probe.patch 2021-11-10 14:17:01.780746827 +0800
@@ -1 +1 @@
-From da0280b3a34c6f67f7e558fcc86c3110816fea28 Mon Sep 17 00:00:00 2001
+From 6b6aacee7102439684c272bd1513eff6e70cdffd Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit da0280b3a34c6f67f7e558fcc86c3110816fea28 ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -19 +21 @@
- drivers/net/pcap/pcap_ethdev.c | 30 ++++++++++++++++++++++++++++++
+ drivers/net/pcap/rte_eth_pcap.c | 30 ++++++++++++++++++++++++++++++
@@ -22,5 +24,5 @@
-diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
-index a8774b7a43..5c4cdbf873 100644
---- a/drivers/net/pcap/pcap_ethdev.c
-+++ b/drivers/net/pcap/pcap_ethdev.c
-@@ -1362,6 +1362,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev,
+diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
+index da4dfe799e..2e8ac55b72 100644
+--- a/drivers/net/pcap/rte_eth_pcap.c
++++ b/drivers/net/pcap/rte_eth_pcap.c
+@@ -1366,6 +1366,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev,
@@ -60 +62 @@
-@@ -1582,6 +1609,9 @@ create_eth:
+@@ -1586,6 +1613,9 @@ create_eth:
More information about the stable
mailing list