🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
5 messages
5 total messages Started by Xia Yan Fri, 06 Nov 2026 08:48
[PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
#12088
Author: Xia Yan
Date: Fri, 06 Nov 2026 08:48
33 lines
9922 bytes
hellcreek_led_setup() walks the two LED child nodes of the "leds" node
with of_get_next_available_child(). The helper drops the reference on
the child passed to it and takes one on the child it returns. After
the second call the caller holds a reference on the second LED node.

That reference is never dropped. The out: label only releases the
"leds" node itself. Boards with both LED child nodes leak one
device_node reference per probe, on the registration failures as well
as on the success path.

Drop it at the out: label, before the parent node. The early exits,
where the walk stopped before the second child, pass NULL, which
of_node_put() ignores.

Found during a code review of the OF node handling in DSA drivers.

Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
---
  drivers/net/dsa/hirschmann/hellcreek_ptp.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
index cb23bea9c21b..ed27731d4f4e 100644
--- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
+++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
@@ -392,6 +392,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek)
 	ret = 0;
 
 out:
+	of_node_put(led);
 	of_node_put(leds);
 
 	return ret;
Re: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
#12086
Author: netdev-bot+sinfo
Date: Fri, 06 Nov 2026 08:51
18 lines
8668 bytes
Hi!

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

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by code inspection). If it was triggered please include
   the symptoms, like the stack trace or error messages.

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. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Re: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
#12091
Author: Xia Yan
Date: Fri, 06 Nov 2026 08:59
15 lines
9438 bytes
On 11/6/26 16:51, netdev-bot+sinfo wrote:
>  - Whether the issue was actually triggered, or is only theoretical
>    (e.g. found by code inspection). If it was triggered please include
>    the symptoms, like the stack trace or error messages.

Hi,

The leak was not hit at runtime. I found it by code inspection while
reviewing the OF node handling in DSA drivers, as the commit message
notes. There is no stack trace: the effect would be one device_node
reference leaked per probe and never released.

Thanks,
Xia Yan
Re: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
#12121
Author: Kurt Kanzenbach
Date: Fri, 06 Nov 2026 09:54
48 lines
11161 bytes
--=-=-=
Content-Type: text/plain

On Fri Nov 06 2026, Xia Yan wrote:
> hellcreek_led_setup() walks the two LED child nodes of the "leds" node
> with of_get_next_available_child(). The helper drops the reference on
> the child passed to it and takes one on the child it returns. After
> the second call the caller holds a reference on the second LED node.
>
> That reference is never dropped. The out: label only releases the
> "leds" node itself. Boards with both LED child nodes leak one
> device_node reference per probe, on the registration failures as well
> as on the success path.
>
> Drop it at the out: label, before the parent node. The early exits,
> where the walk stopped before the second child, pass NULL, which
> of_node_put() ignores.
>
> Found during a code review of the OF node handling in DSA drivers.
>
> Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>

Looks correct to me. Thanks.

Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEEvLm/ssjDfdPf21mSwZPR8qpGc4IFAmrto7wTHGt1cnRAbGlu
dXRyb25peC5kZQAKCRDBk9HyqkZzgo41D/4gyOaQNDqjbzRLowk8LgGbkclsSn/v
5S7PCq6xlSWa7ckWoMIXJrwfczi0FJWbAIySym5RvEHyc0n8FVQAIJHexzhr2mgH
AIdHlhjKzfmpn5PLc76kMGKY7gyguBHzHs5Mo8fcPEmK44DUyK4KNcSKcV0WOzbn
66HKy63lx80ve/WL5nJo4J3S3725rsVOukQSO//mbd9N3ijeODW4yV3PwQmzkuJA
t0YQVrLU2sumn1z0DonSeAjasnUVbL3isCTYDTF1SrT6UAHrJ5jMlGMEOqF3iT5Z
xAV8bk8AwjdGpkHH1SFoSlYkBO5RAAJZ201nPbQhS6BMjuMS16cUoAesL2TVwEIB
047YTaUWkB9fgbR4ZLVHZWwKKeke9UMh5bc/ud40husZ+Zh+kqOvUawmhH4oP5GF
QShsAuwYauYRTIjxzEopg57nl8Chv6YEQzi4A0xI83QJ2nwh00BUHWwzMr3BqArl
C7H/F+nuZHMNpou/tnSRD/Bm6f2nzKs3iFTN3ZAsg2fbIhwnKjbyiyw6D3BSGDVX
6OGtSGQwv1gkY1xpXmy9kYZ45/I2Es9CuWhXhhi7p/4jqPtMFCqwzlPGM9amkCz1
KQMWOQPV8aoMqgXxB2RBLafQIzz/jcPhqdzzfHOmmiNFkRgKOjyTHJISBMxptnRo
Vsg7J1Zu31Twgg==
=uKOP
-----END PGP SIGNATURE-----
--=-=-=--
Re: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
#14398
Author: patchwork-bot+netdevbpf
Date: Wed, 11 Nov 2026 05:50
27 lines
9032 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>:

On Fri, 06 Nov 2026 16:48:32 +0800 you wrote:
> hellcreek_led_setup() walks the two LED child nodes of the "leds" node
> with of_get_next_available_child(). The helper drops the reference on
> the child passed to it and takes one on the child it returns. After
> the second call the caller holds a reference on the second LED node.
> 
> That reference is never dropped. The out: label only releases the
> "leds" node itself. Boards with both LED child nodes leak one
> device_node reference per probe, on the registration failures as well
> as on the success path.
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
    https://git.kernel.org/netdev/net-next/c/c4c470912125

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads