net/ixgbe: fix resource leak after thread exits normally
diff mbox series

Message ID
State Superseded, archived
Delegated to: xiaolong ye
Headers show
  • net/ixgbe: fix resource leak after thread exits normally
Related show


Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch warning coding style issues

Commit Message

Zhu, TaoX April 10, 2020, 5:18 a.m. UTC
From: "Zhu, Tao" <>

When the thread exits normally, pthread_join() is not called, which can
result in a resource leak. Therefore, the thread is set to separation
mode using function pthread_detach(), so that no program call
pthread_join() is required to recycle, and when the thread exits,
the system automatically reclaims resources.

Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")

Signed-off-by: Zhu Tao <>
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff mbox series

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2c57976..f141ae4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4165,11 +4165,9 @@  static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev)
 	struct ixgbe_adapter *ad = dev->data->dev_private;
-	void *retval;
 	if (!ixgbe_dev_wait_setup_link_complete(dev)) {
-		pthread_join(ad->link_thread_tid, &retval);
 		PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!");
@@ -4186,6 +4184,7 @@  static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 	u32 speed;
 	bool autoneg = false;
+	pthread_detach(pthread_self());
 	speed = hw->phy.autoneg_advertised;
 	if (!speed)
 		ixgbe_get_link_capabilities(hw, &speed, &autoneg);