Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: ti: icssg-prueth: fix device node leak in prueth_netdev_init()
@ 2026-11-28 16:59 Yuwei Chen
  2026-11-28 17:03 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Yuwei Chen @ 2026-11-28 16:59 UTC (permalink / raw)
  To: netdev; +Cc: MD Danish Anwar, Roger Quadros, linux-arm-kernel

prueth_netdev_init() looks up the PHY node by calling
of_parse_phandle() but never drops the reference to the OF node.
Let's fix it.

Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Fixes: e654b85a693e ("net: ti: icssg-prueth: Add ICSSG Ethernet driver for AM65x SR1.0 platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Yuwei Chen <2522445001@qq.com>
---
 drivers/net/ethernet/ti/icssg/icssg_common.c     | 2 ++
 drivers/net/ethernet/ti/icssg/icssg_prueth.c     | 8 +++++++-
 drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 8 +++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
index 4a7d1a6f470b..5149493a0bf7 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_common.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
@@ -1752,6 +1752,8 @@ void prueth_netdev_exit(struct prueth *prueth,
 	if (of_phy_is_fixed_link(emac->phy_node))
 		of_phy_deregister_fixed_link(emac->phy_node);
 
+	of_node_put(emac->phy_node);
+
 	netif_napi_del(&emac->napi_rx);
 
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index c9659a3d40dc..f483535ba130 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -1717,13 +1717,16 @@ static int prueth_netdev_init(struct prueth *prueth,
 		ret = -ENODEV;
 		goto free;
 	} else if (of_phy_is_fixed_link(eth_node)) {
+		of_node_put(emac->phy_node);
+		emac->phy_node = NULL;
+
 		ret = of_phy_register_fixed_link(eth_node);
 		if (ret) {
 			dev_err_probe(prueth->dev, ret, "failed to register fixed-link phy\n");
 			goto free;
 		}
 
-		emac->phy_node = eth_node;
+		emac->phy_node = of_node_get(eth_node);
 	}
 
 	ret = of_get_phy_mode(eth_node, &emac->phy_if);
@@ -1791,6 +1794,9 @@ static int prueth_netdev_init(struct prueth *prueth,
 	return 0;
 
 free:
+	if (of_phy_is_fixed_link(emac->phy_node))
+		of_phy_deregister_fixed_link(emac->phy_node);
+	of_node_put(emac->phy_node);
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
 free_ndev:
 	emac->ndev = NULL;
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
index 7aab221fead0..1ea69cdfa36e 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
@@ -811,13 +811,16 @@ static int prueth_netdev_init(struct prueth *prueth,
 		ret = -ENODEV;
 		goto free;
 	} else if (of_phy_is_fixed_link(eth_node)) {
+		of_node_put(emac->phy_node);
+		emac->phy_node = NULL;
+
 		ret = of_phy_register_fixed_link(eth_node);
 		if (ret) {
 			dev_err_probe(prueth->dev, ret, "failed to register fixed-link phy\n");
 			goto free;
 		}
 
-		emac->phy_node = eth_node;
+		emac->phy_node = of_node_get(eth_node);
 	}
 
 	ret = of_get_phy_mode(eth_node, &emac->phy_if);
@@ -877,6 +880,9 @@ static int prueth_netdev_init(struct prueth *prueth,
 	return 0;
 
 free:
+	if (of_phy_is_fixed_link(emac->phy_node))
+		of_phy_deregister_fixed_link(emac->phy_node);
+	of_node_put(emac->phy_node);
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
 free_ndev:
 	emac->ndev = NULL;

base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
-- 
2.53.0.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: ti: icssg-prueth: fix device node leak in prueth_netdev_init()
  2026-11-28 16:59 [PATCH net] net: ti: icssg-prueth: fix device node leak in prueth_netdev_init() Yuwei Chen
@ 2026-11-28 17:03 ` netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-28 17:03 UTC (permalink / raw)
  To: Yuwei Chen; +Cc: netdev, MD Danish Anwar, Roger Quadros, linux-arm-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-28 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 16:59 [PATCH net] net: ti: icssg-prueth: fix device node leak in prueth_netdev_init() Yuwei Chen
2026-11-28 17:03 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox