[PATCH 3/4] net/axgbe: destroy mutexes on device close

Stephen Hemminger
2026-02-18T16:43:48Z

Four pthread mutexes (xpcs_mutex, i2c_mutex, an_mutex, phy_mutex)
are initialized in eth_axgbe_dev_init() but never destroyed in
axgbe_dev_close(). This leaks kernel resources on every device
close/reopen cycle.

Add pthread_mutex_destroy() calls to the close path.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/axgbe/axgbe_ethdev.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 709a52acc8..c8414998b4 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -2482,6 +2482,11 @@ axgbe_dev_close(struct rte_eth_dev *eth_dev)
/* Disable all interrupts in the hardware */
XP_IOWRITE(pdata, XP_INT_EN, 0x0);

+ pthread_mutex_destroy(&pdata->xpcs_mutex);
+ pthread_mutex_destroy(&pdata->i2c_mutex);
+ pthread_mutex_destroy(&pdata->an_mutex);
+ pthread_mutex_destroy(&pdata->phy_mutex);
+
return 0;
}

--
2.51.0