From: Helge Deller <deller@gmx.de>
To: Guangshuo Li <lgs201920130244@gmail.com>,
linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] parisc: led: fix reference leak on failed device registration
Date: Fri, 17 Apr 2026 11:39:36 +0200 [thread overview]
Message-ID: <929ebeca-d070-4537-b3f5-3a4c93f1301d@gmx.de> (raw)
In-Reply-To: <20260415170515.3605095-1-lgs201920130244@gmail.com>
On 4/15/26 19:05, Guangshuo Li wrote:
> When platform_device_register() fails in startup_leds(), the embedded
> struct device in platform_leds has already been initialized by
> device_initialize(), but the failure path only reports the error and
> does not drop the device reference for the current platform device:
>
> startup_leds()
> -> platform_device_register(&platform_leds)
> -> device_initialize(&platform_leds.dev)
> -> setup_pdev_dma_masks(&platform_leds)
> -> platform_device_add(&platform_leds)
>
> This leads to a reference leak when platform_device_register() fails.
> Fix this by calling platform_device_put() after reporting the error.
>
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review.
>
> Fixes: 789e527adfc33 ("parisc: led: Rewrite LED/LCD driver to utilizize Linux LED subsystem")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/parisc/led.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
applied.
Thanks!
Helge
next prev parent reply other threads:[~2026-04-17 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 17:05 Guangshuo Li
2026-04-17 9:39 ` Helge Deller [this message]
2026-04-23 5:24 ` Jiri Slaby
2026-04-23 7:09 ` Helge Deller
2026-04-24 8:25 ` Guangshuo Li
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=929ebeca-d070-4537-b3f5-3a4c93f1301d@gmx.de \
--to=deller@gmx.de \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/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®