Skip to contentSkip to conversation

net: fsl_pq_mdio: Fix device node reference leak in fsl_pq_mdio_probe

PATCH Applied Erick Karanja 4 participants 6 messages Oct 2, 2025 – Oct 6, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fsl_pq_mdio: Fix device node reference leak in fsl_pq_mdio_probe

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Fixes afae5ad78b342 ("net/fsl_pq_mdio: streamline probing of MDIO nodes")
---
 drivers/net/ethernet/freescale/fsl_pq_mdio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fsl_pq_mdio.c +2 -0
index 577f9b1780ad..de88776dd2a2 100644
@@ -479,10 +479,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
 					"missing 'reg' property in node %pOF\n",
 					tbi);
 				err = -EBUSY;
+				of_node_put(tbi);
 				goto error;
 			}
 			set_tbipa(*prop, pdev,
 				  data->get_tbipa, priv->map, &res);
+			of_node_put(tbi);
 		}
 	}
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Erick Karanja

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Fixes afae5ad78b342 ("net/fsl_pq_mdio: streamline probing of MDIO nodes")

nit: no blank line here

Slightly more importantly, although the code you are changing was added by the cited commit, I think that the bug existed before then. I wonder if the fixes tag should be.

Fixes daa26ea63c6f ("Merge branch 'octeontx2-fix-bitmap-leaks-in-pf-and-vf'")
Quoted 2 lines

One minor comment on process: as a fix for networking code, most likely this should be targeted at the net tree. And that should be denoted in the subject like this:

Subject: [PATCH net] ...

And if you do post an updated version, which is probably not strictly necessary, please be sure to observe the 24h rule.

See: https://docs.kernel.org/process/maintainer-netdev.html

The code changes themselves look good to me. Thanks.

...

reviewer
#2 lore raw
Quoted 6 lines · Simon Horman
Quoted 4 lines · Erick Karanja

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Fixes afae5ad78b342 ("net/fsl_pq_mdio: streamline probing of MDIO nodes")
Quoted 7 lines

nit: no blank line here

Slightly more importantly, although the code you are changing was added by the cited commit, I think that the bug existed before then. I wonder if the fixes tag should be.

Fixes daa26ea63c6f ("Merge branch 'octeontx2-fix-bitmap-leaks-in-pf-and-vf'")

Sorry the above is obviously bogus.
I should have said:

Fixes 1577ecef7666 ("netdev: Merge UCC and gianfar MDIO bus drivers")
Quoted 21 lines
Quoted 3 lines

One minor comment on process: as a fix for networking code, most likely this should be targeted at the net tree. And that should be denoted in the subject like this:

Subject: [PATCH net] ...

And if you do post an updated version, which is probably not strictly necessary, please be sure to observe the 24h rule.

See: https://docs.kernel.org/process/maintainer-netdev.html

The code changes themselves look good to me. Thanks.

...

#3 lore raw
In reply to Erick Karanja
Quoted 2 lines

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Will it become helpful to append parentheses to function names?

Regards,
Markus

#4 lore raw
Quoted 4 lines · Markus Elfring
Quoted 2 lines

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Will it become helpful to append parentheses to function names?

Yes, it is necessary.

Quoted 3 lines

Regards,
Markus

#5 lore raw
In reply to Erick Karanja
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 2 Oct 2025 20:46:17 +0300 you wrote:

Add missing of_node_put call to release device node tbi obtained via for_each_child_of_node.

Fixes afae5ad78b342 ("net/fsl_pq_mdio: streamline probing of MDIO nodes")

[...]

Here is the summary with links:
- net: fsl_pq_mdio: Fix device node reference leak in fsl_pq_mdio_probe

    https://git.kernel.org/netdev/net/c/521405cb54cd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html