* [PATCH] sparc: Fix leaked platform_device references in archdata propagation
@ 2026-10-11 10:35 Ma Ke
2026-10-14 17:22 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Ma Ke @ 2026-10-11 10:35 UTC (permalink / raw)
To: davem, andreas, o-takashi, u.kleine-koenig, dakr, make_ruc2021,
bhelgaas
Cc: sparclinux, linux-kernel, akpm, stable
of_propagate_archdata() walks the children of a bus node and looks each
one up with of_find_device_by_node(), documented in
drivers/of/platform.c:
* Takes a reference to the embedded struct device which needs to be
* dropped after use.
The reference is never dropped, and because the function recurses, every
child node of every ebus leaks the reference to its platform_device.
Found by code review.
Fixes: 5059625ed886 ("sparc: Add OF archdata propagation helper.")
Cc: stable@vger.kernel.org
Signed-off-by: Ma Ke <make_ruc2021@163.com>
---
arch/sparc/kernel/of_device_common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 7f2f9972b59b..0aae21c4b62c 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -70,6 +70,8 @@ void of_propagate_archdata(struct platform_device *bus)
if (dp->child)
of_propagate_archdata(op);
+
+ platform_device_put(op);
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sparc: Fix leaked platform_device references in archdata propagation
2026-10-11 10:35 [PATCH] sparc: Fix leaked platform_device references in archdata propagation Ma Ke
@ 2026-10-14 17:22 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2026-10-14 17:22 UTC (permalink / raw)
To: Ma Ke
Cc: davem, andreas, o-takashi, u.kleine-koenig, dakr, bhelgaas,
sparclinux, linux-kernel, akpm, stable
On Sun, Oct 11, 2026 at 06:35:44PM +0800, Ma Ke wrote:
> of_propagate_archdata() walks the children of a bus node and looks each
> one up with of_find_device_by_node(), documented in
> drivers/of/platform.c:
>
> * Takes a reference to the embedded struct device which needs to be
> * dropped after use.
>
> The reference is never dropped, and because the function recurses, every
> child node of every ebus leaks the reference to its platform_device.
>
> Found by code review.
>
> Fixes: 5059625ed886 ("sparc: Add OF archdata propagation helper.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ma Ke <make_ruc2021@163.com>
I assume the sparc folks will take this.
Do other callers of of_find_device_by_node() have a similar problem?
irq_of_parse_and_map()
of_address_to_resource()
of_iomap()
of_create_pci_dev()
> ---
> arch/sparc/kernel/of_device_common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
> index 7f2f9972b59b..0aae21c4b62c 100644
> --- a/arch/sparc/kernel/of_device_common.c
> +++ b/arch/sparc/kernel/of_device_common.c
> @@ -70,6 +70,8 @@ void of_propagate_archdata(struct platform_device *bus)
>
> if (dp->child)
> of_propagate_archdata(op);
> +
> + platform_device_put(op);
> }
> }
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-14 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-11 10:35 [PATCH] sparc: Fix leaked platform_device references in archdata propagation Ma Ke
2026-10-14 17:22 ` Bjorn Helgaas
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.