* [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak
@ 2026-06-15 20:05 Yuho Choi
2026-06-16 17:55 ` Andreas Kemnade
2026-07-02 21:13 ` 최유호
0 siblings, 2 replies; 3+ messages in thread
From: Yuho Choi @ 2026-06-15 20:05 UTC (permalink / raw)
To: Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren
Cc: linux-omap, linux-kernel, Yuho Choi
sysc_init_stdout_path() gets the /chosen node with
of_find_node_by_path() to read stdout-path. The function then overwrites
the local node pointer with the stdout-path lookup result, or exits on
error, without dropping the /chosen reference.
Keep the /chosen node in a separate variable and put it after the
stdout-path value has been used for the lookup. The successful stdout
node lookup remains referenced by the cached stdout_path pointer.
Fixes: 3bb37c8e6e6a ("bus: ti-sysc: Handle stdout-path for debug console")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/bus/ti-sysc.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index a5b9507de37c..e118b900c9ac 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -682,6 +682,7 @@ static struct device_node *stdout_path;
static void sysc_init_stdout_path(struct sysc *ddata)
{
+ struct device_node *chosen;
struct device_node *np = NULL;
const char *uart;
@@ -691,15 +692,18 @@ static void sysc_init_stdout_path(struct sysc *ddata)
if (stdout_path)
return;
- np = of_find_node_by_path("/chosen");
- if (!np)
+ chosen = of_find_node_by_path("/chosen");
+ if (!chosen)
goto err;
- uart = of_get_property(np, "stdout-path", NULL);
- if (!uart)
+ uart = of_get_property(chosen, "stdout-path", NULL);
+ if (!uart) {
+ of_node_put(chosen);
goto err;
+ }
np = of_find_node_by_path(uart);
+ of_node_put(chosen);
if (!np)
goto err;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak
2026-06-15 20:05 [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak Yuho Choi
@ 2026-06-16 17:55 ` Andreas Kemnade
2026-07-02 21:13 ` 최유호
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Kemnade @ 2026-06-16 17:55 UTC (permalink / raw)
To: Yuho Choi
Cc: Aaro Koskinen, Kevin Hilman, Roger Quadros, Tony Lindgren,
linux-omap, linux-kernel
On Mon, 15 Jun 2026 16:05:40 -0400
Yuho Choi <dbgh9129@gmail.com> wrote:
> sysc_init_stdout_path() gets the /chosen node with
> of_find_node_by_path() to read stdout-path. The function then overwrites
> the local node pointer with the stdout-path lookup result, or exits on
> error, without dropping the /chosen reference.
>
> Keep the /chosen node in a separate variable and put it after the
> stdout-path value has been used for the lookup. The successful stdout
> node lookup remains referenced by the cached stdout_path pointer.
>
> Fixes: 3bb37c8e6e6a ("bus: ti-sysc: Handle stdout-path for debug console")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak
2026-06-15 20:05 [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak Yuho Choi
2026-06-16 17:55 ` Andreas Kemnade
@ 2026-07-02 21:13 ` 최유호
1 sibling, 0 replies; 3+ messages in thread
From: 최유호 @ 2026-07-02 21:13 UTC (permalink / raw)
To: Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
Tony Lindgren
Cc: linux-omap, linux-kernel
Hi,
Just a gentle ping on this patch.
I would appreciate any feedback when you have a chance to review this.
Thanks
On Mon, 15 Jun 2026 at 16:05, Yuho Choi <dbgh9129@gmail.com> wrote:
>
> sysc_init_stdout_path() gets the /chosen node with
> of_find_node_by_path() to read stdout-path. The function then overwrites
> the local node pointer with the stdout-path lookup result, or exits on
> error, without dropping the /chosen reference.
>
> Keep the /chosen node in a separate variable and put it after the
> stdout-path value has been used for the lookup. The successful stdout
> node lookup remains referenced by the cached stdout_path pointer.
>
> Fixes: 3bb37c8e6e6a ("bus: ti-sysc: Handle stdout-path for debug console")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---
> drivers/bus/ti-sysc.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> index a5b9507de37c..e118b900c9ac 100644
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -682,6 +682,7 @@ static struct device_node *stdout_path;
>
> static void sysc_init_stdout_path(struct sysc *ddata)
> {
> + struct device_node *chosen;
> struct device_node *np = NULL;
> const char *uart;
>
> @@ -691,15 +692,18 @@ static void sysc_init_stdout_path(struct sysc *ddata)
> if (stdout_path)
> return;
>
> - np = of_find_node_by_path("/chosen");
> - if (!np)
> + chosen = of_find_node_by_path("/chosen");
> + if (!chosen)
> goto err;
>
> - uart = of_get_property(np, "stdout-path", NULL);
> - if (!uart)
> + uart = of_get_property(chosen, "stdout-path", NULL);
> + if (!uart) {
> + of_node_put(chosen);
> goto err;
> + }
>
> np = of_find_node_by_path(uart);
> + of_node_put(chosen);
> if (!np)
> goto err;
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-02 21:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 20:05 [PATCH v1] bus: ti-sysc: Fix /chosen node reference leak Yuho Choi
2026-06-16 17:55 ` Andreas Kemnade
2026-07-02 21:13 ` 최유호
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome