[PATCH net-next 1/2] net: ethernet: ixp4xx: fix OF node leaks in ixp4xx_of_get_platdata()
zhaofeng2
zhaofeng2 at cmss.chinamobile.com
Mon Nov 9 23:08:01 PST 2026
From: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
ixp4xx_of_get_platdata() resolves the NPE and the RX/TX-ready queue
phandles with of_parse_phandle_with_fixed_args(), which takes a
reference on the resolved device node, but the references are never
dropped, so the NPE and queue manager device nodes are leaked on every
probe. Since the DT parsing happens before the -EPROBE_DEFER check
for the MDIO bus instance, the leak also repeats on every probe
deferral.
Drop the references with of_node_put() once the phandle argument has
been consumed.
Fixes: 95aafe911db6 ("net: ethernet: ixp4xx: Support device tree probing")
Signed-off-by: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
---
drivers/net/ethernet/xscale/ixp4xx_eth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1397,6 +1397,7 @@
}
/* NPE ID 0x00, 0x10, 0x20... */
plat->npe = (npe_spec.args[0] << 4);
+ of_node_put(npe_spec.np);
/* Check if this device has an MDIO bus */
mdio_np = of_get_child_by_name(np, "mdio");
@@ -1414,6 +1415,7 @@
return NULL;
}
plat->rxq = queue_spec.args[0];
+ of_node_put(queue_spec.np);
/* Get the txready queue as resource from queue manager */
ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0,
@@ -1423,6 +1425,7 @@
return NULL;
}
plat->txreadyq = queue_spec.args[0];
+ of_node_put(queue_spec.np);
ret = of_get_mac_address(np, mac);
if (!ret) {
More information about the linux-arm-kernel
mailing list