From: Kurt Kanzenbach <kurt@linutronix.de>
To: Xia Yan <yanxia@cmss.chinamobile.com>, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
Richard Cochran <richardcochran@gmail.com>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Pavel Zhigulin <Pavel.Zhigulin@kaspersky.com>,
linux-kernel@vger.kernel.org, yana06070@163.com
Subject: Re: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()
Date: Fri, 06 Nov 2026 10:54:04 +0100 [thread overview]
Message-ID: <87mrrmz3nn.fsf@jax.kurt.home> (raw)
In-Reply-To: <1793954912000.3200.3087525628285919529@cmss.chinamobile.com>
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
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>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2026-11-06 9:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 8:48 [PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup() Xia Yan
2026-11-06 8:51 ` netdev-bot+sinfo
2026-11-06 8:59 ` Xia Yan
2026-11-06 9:54 ` Kurt Kanzenbach [this message]
2026-11-11 5:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mrrmz3nn.fsf@jax.kurt.home \
--to=kurt@linutronix.de \
--cc=Pavel.Zhigulin@kaspersky.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=yana06070@163.com \
--cc=yanxia@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.