driver/net/pcap: fix fd leak

Message ID 20210225085902.2536-1-zhangtengfei@oppo.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series driver/net/pcap: fix fd leak |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail apply issues

Commit Message

ZhangTengfei Feb. 25, 2021, 8:59 a.m. UTC
  pcap file was opened when pcap vdev probed; but was not closed where vdev removed.
This bug appears in dpdk-pdump

Signed-off-by: ZhangTengfei <zhangtengfei@oppo.com>
---
 drivers/net/pcap/rte_eth_pcap.c | 1 +
 1 file changed, 1 insertion(+)

--
2.25.1
  

Patch

diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 90f5d75ea..96d189f19 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1597,6 +1597,7 @@  pmd_pcap_remove(struct rte_vdev_device *dev)
        if (eth_dev == NULL)
                return 0; /* port already released */

+    eth_dev_stop(eth_dev);
        eth_dev_close(eth_dev);
        rte_eth_dev_release_port(eth_dev);