patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/pcap: fix fd leak on uninit
@ 2021-03-02 16:51 Tengfei Zhang
  2021-03-03 14:26 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Tengfei Zhang @ 2021-03-02 16:51 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Tengfei Zhang, stable

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

Fixes: c956caa6eabf ("pcap: support port hotplug")
Cc: stable@dpdk.org

Signed-off-by: Tengfei Zhang <zypscode@outlook.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 90f5d75ea..49b9a1f44 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/pcap: fix fd leak on uninit
  2021-03-02 16:51 [dpdk-stable] [PATCH] net/pcap: fix fd leak on uninit Tengfei Zhang
@ 2021-03-03 14:26 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2021-03-03 14:26 UTC (permalink / raw)
  To: Tengfei Zhang; +Cc: dev, stable

On 3/2/2021 4:51 PM, Tengfei Zhang wrote:
> pcap fd was opend when vdev probed,
> but not closed when vdev removed.
> 
> Fixes: c956caa6eabf ("pcap: support port hotplug")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tengfei Zhang <zypscode@outlook.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-03 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 16:51 [dpdk-stable] [PATCH] net/pcap: fix fd leak on uninit Tengfei Zhang
2021-03-03 14:26 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git