From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] arm_pmu: acpi: fix reference leak on failed device registration
Date: Wed, 15 Apr 2026 18:31:38 +0000 [thread overview]
Message-ID: <20260415183138.C64C7C19424@smtp.kernel.org> (raw)
In-Reply-To: <20260415174159.3625777-1-lgs201920130244@gmail.com>
Sashiko AI review found 1 potential issue(s):
- [High] Calling platform_device_put() on statically allocated platform devices triggers a kernel WARN.
--
commit 3d6b3748275060c9fa53f46ef32bdbc93f8522c7
Author: Guangshuo Li <lgs201920130244@gmail.com>
arm_pmu: acpi: fix reference leak on failed device registration
This commit attempts to fix a reference leak when platform_device_register()
fails in arm_acpi_register_pmu_device() by calling platform_device_put()
on the failed path.
> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> index e80f76d95e68b..5ce382661e344 100644
> --- a/drivers/perf/arm_pmu_acpi.c
> +++ b/drivers/perf/arm_pmu_acpi.c
[ ... ]
> @@ -119,8 +119,10 @@ arm_acpi_register_pmu_device(struct platform_device *pdev, u8 len,
>
> pdev->resource[0].start = irq;
> ret = platform_device_register(pdev);
> - if (ret)
> + if (ret) {
> acpi_unregister_gsi(gsi);
> + platform_device_put(pdev);
Does this cause a kernel warning when called on statically allocated platform
devices?
The arm_acpi_register_pmu_device() function is called with statically
allocated platform devices:
arm_spe_acpi_register_device()
arm_acpi_register_pmu_device(&spe_dev, ...)
arm_trbe_acpi_register_device()
arm_acpi_register_pmu_device(&trbe_dev, ...)
Because these devices are statically allocated and not created via
platform_device_alloc(), they do not have a .dev.release callback
configured.
When platform_device_put() drops the reference count to 0, the driver core's
device_release() function will see the missing release callback and trigger
a warning splat.
On systems with panic_on_warn enabled, could this turn a benign device
registration failure into a kernel panic?
> + }
>
> return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260415174159.3625777-1-lgs201920130244@gmail.com?part=1
prev parent reply other threads:[~2026-04-15 18:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 17:41 [PATCH] arm_pmu: acpi: fix reference leak on failed device registration Guangshuo Li
2026-04-15 18:19 ` Mark Rutland
2026-04-16 4:40 ` Greg Kroah-Hartman
2026-04-16 6:34 ` Guangshuo Li
2026-04-16 7:23 ` Johan Hovold
2026-04-16 8:59 ` Guangshuo Li
2026-04-16 9:50 ` Mark Rutland
2026-04-16 9:30 ` Mark Rutland
2026-04-20 7:28 ` Johan Hovold
2026-04-20 8:05 ` Greg Kroah-Hartman
2026-04-15 18:31 ` sashiko-bot [this message]
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=20260415183138.C64C7C19424@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
/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.