[PATCH v13 02/25] net/dpaa: fix free port resources on close
From: Hemant Agrawal <hidden>
Date: 2026-08-19 10:50:22
Subsystem:
networking drivers, the rest · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
dpaa_intf->tx_conf_queues is allocated unconditionally for every port
in dpaa_dev_init():
dpaa_intf->tx_conf_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) *
MAX_DPAA_CORES, MAX_CACHELINE);
but it is never released. It is a driver private allocation, so
rte_eth_dev_release_port() does not free it either. The memory is
therefore leaked on every device close and on every probe failure that
happens after the allocation.
dpaa_eth_dev_close() returned early for offline (O/H) and ONIC ports,
before the common cleanup that frees the queue and congestion-group
memory allocated at probe. Added support to clean that path as well.
Fixes: 58e0420f72f8 ("net/dpaa: support Tx confirmation to enable PTP")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <redacted>
---
drivers/net/dpaa/dpaa_ethdev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 77730f16e3..00ab436ad1 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c@@ -537,7 +537,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) if (fif->mac_type == fman_offline_internal || fif->mac_type == fman_onic) - return 0; + goto clean_1; /* Reset link to autoneg */ if (link->link_status && !link->link_autoneg) {
@@ -562,7 +562,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) dev->data->name, ret); } } - +clean_1: /* release configuration memory */ rte_free(dpaa_intf->fc_conf);
@@ -624,6 +624,9 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) } } + rte_free(dpaa_intf->tx_conf_queues); + dpaa_intf->tx_conf_queues = NULL; + return ret; }
@@ -2497,6 +2500,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) return 0; free_tx: + rte_free(dpaa_intf->tx_conf_queues); + dpaa_intf->tx_conf_queues = NULL; rte_free(dpaa_intf->tx_queues); dpaa_intf->tx_queues = NULL; dpaa_intf->nb_tx_queues = 0;
--
2.25.1