[PATCH v2 4/9] net/ixgbe: fix MAC address leak on device reset
Anurag Mandal
anurag.mandal at intel.com
Tue Dec 1 11:55:15 CET 2026
Since the MAC address arrays are freed by
rte_eth_dev_release_port(), the driver uninit
functions no longer free them.
A device reset runs uninit and init without
releasing the port, and init allocates new arrays
over the old ones.
Each PF reset leaks the MAC and hash MAC address
arrays, and each VF reset leaks the MAC address
array.
Free the previous array just before allocating
its replacement in init.
Freeing it in the reset callbacks instead would
leave it NULL when init fails earlier, e.g. when
a VF reset returns -EAGAIN while the PF is resetting,
and ixgbevf_dev_close() would then walk a NULL array.
Fixes: e16adf08e54d ("ethdev: free all common data when releasing port")
Cc: stable at dpdk.org
Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index b832ff1f07..475045c825 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -1186,6 +1186,9 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
/* reset mappings for queue statistics hw counters*/
ixgbe_reset_qstat_mappings(hw);
+ /* dev_reset re-runs init with the previous arrays still allocated */
+ rte_free(eth_dev->data->mac_addrs);
+
/* Allocate memory for storing MAC addresses */
eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", RTE_ETHER_ADDR_LEN *
hw->mac.num_rar_entries, 0);
@@ -1202,6 +1205,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
ð_dev->data->mac_addrs[0]);
/* Allocate memory for storing hash filter MAC addresses */
+ rte_free(eth_dev->data->hash_mac_addrs);
eth_dev->data->hash_mac_addrs = rte_zmalloc(
"ixgbe", RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC, 0);
if (eth_dev->data->hash_mac_addrs == NULL) {
@@ -1562,6 +1566,9 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
/* Get Rx/Tx queue count via mailbox, which is ready after reset_hw */
ixgbevf_get_queues(hw, &tcs, &tc);
+ /* dev_reset re-runs init with the previous array still allocated */
+ rte_free(eth_dev->data->mac_addrs);
+
/* Allocate memory for storing MAC addresses */
eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", RTE_ETHER_ADDR_LEN *
hw->mac.num_rar_entries, 0);
--
2.25.1
More information about the stable
mailing list