From: sashiko-bot@kernel.org
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Linux PCI" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v2] ACPI: PM: Avoid initializing power management for absent devices
Date: Tue, 17 Nov 2026 18:25:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-219338@kernel.org> (raw)
In-Reply-To: <2859265.mvXUDI8C0e@rafael.j.wysocki>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ACPI: PM: acpi_bus_init_power() clears power_manageable without
poisoning state
--
commit 0fdc7a0041a301b9912e9f5aa11b4ed9de27fe02
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: PM: Avoid initializing power management for absent devices
This commit restores the device presence check in acpi_bus_init_power() and
updates find_child_checks() to reject absent devices rather than disabled
ones.
> diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
> index 76104f715efa1..ac2f8579110f0 100644
> --- a/drivers/acpi/device_pm.c
> +++ b/drivers/acpi/device_pm.c
> @@ -360,6 +360,13 @@ int acpi_bus_init_power(struct acpi_device *device)
> if (device->power.state != ACPI_STATE_UNKNOWN)
> return 0;
>
> + if (!acpi_device_is_present(device)) {
> + device->flags.power_manageable = 0;
> + acpi_handle_debug(device->handle,
> + "Device not present, ACPI PM disabled\n");
> + return -ENXIO;
> + }
[Severity: High]
Can clearing device->flags.power_manageable while leaving
device->power.state as ACPI_STATE_UNKNOWN break ACPI PM and leak D0 power
resource references if the device later becomes present?
If acpi_bus_init_power() is called while a device is absent (for example
via acpi_power_up_if_adr_present() before a parent bridge is powered up or
during hotplug) and called again in acpi_bus_attach() after
acpi_bus_get_status() refreshes _STA, the second call proceeds to
acpi_device_init_power() with device->flags.power_manageable still set to 0
because 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power()
early") removed the re-initialization of power_manageable from
acpi_bus_attach().
Inside acpi_device_init_power(), acpi_device_get_power() sees
!device->flags.power_manageable and reports the parent's state (D0), after
which acpi_device_init_power() checks device->power.flags.power_resources
and calls acpi_power_on_resources() for D0:
drivers/acpi/device_pm.c:acpi_device_init_power() {
...
result = acpi_device_get_power(device, &state);
if (result)
return result;
if (state < ACPI_STATE_D3_COLD && device->power.flags.power_resources) {
/* Reference count the power resources. */
result = acpi_power_on_resources(device, state);
...
}
Because device->flags.power_manageable remains 0, subsequent calls to
acpi_device_set_power() fail with -EINVAL, leaving ACPI PM disabled for the
device and permanently leaking the D0 power resource references acquired
above.
--
Sashiko AI review · https://sashiko.dev/#/patchset/2859265.mvXUDI8C0e@rafael.j.wysocki?part=1
prev parent reply other threads:[~2026-11-17 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:58 [PATCH v2] ACPI: PM: Avoid initializing power management for absent devices Rafael J. Wysocki
2026-11-17 18:25 ` 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=sashiko-outbox-219338@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox