From: Ma Ke <make_ruc2021@163.com>
To: davem@davemloft.net, andreas@gaisler.com,
o-takashi@sakamocchi.jp, u.kleine-koenig@baylibre.com,
dakr@kernel.org, make_ruc2021@163.com, bhelgaas@google.com
Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, stable@vger.kernel.org
Subject: [PATCH] sparc: Fix leaked platform_device references in archdata propagation
Date: Sun, 11 Oct 2026 18:35:44 +0800 [thread overview]
Message-ID: <20261011103544.3237228-1-make_ruc2021@163.com> (raw)
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
next reply other threads:[~2026-10-11 10:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 10:35 Ma Ke [this message]
2026-10-14 17:22 ` Bjorn Helgaas
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=20261011103544.3237228-1-make_ruc2021@163.com \
--to=make_ruc2021@163.com \
--cc=akpm@linux-foundation.org \
--cc=andreas@gaisler.com \
--cc=bhelgaas@google.com \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=sparclinux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®