FAILED: patch "[PATCH] ACPI: scan: Use acpi_dev_put() in object add error paths" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 9c0acc169ac71535477caedea8315f7041c5f07c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026050748-hypocrite-astonish-bb51@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9c0acc169ac71535477caedea8315f7041c5f07c Mon Sep 17 00:00:00 2001
From: Guangshuo Li <[email protected]>
Date: Mon, 13 Apr 2026 21:53:43 +0800
Subject: [PATCH] ACPI: scan: Use acpi_dev_put() in object add error paths
After acpi_init_device_object(), the lifetime of struct acpi_device is managed by the driver core through reference counting.
Both acpi_add_power_resource() and acpi_add_single_object() call acpi_init_device_object() and then invoke acpi_device_add(). If that fails, their error paths call the release callback directly instead of dropping the device reference through acpi_dev_put().
This bypasses the normal device lifetime rules and frees the object without releasing the reference acquired by device_initialize(), which may lead to a refcount leak.
The issue was identified by a static analysis tool I developed and confirmed by manual review.
Fix both error paths by using acpi_dev_put() and let the release callback handle the final cleanup.
drivers/acpi/power.c +1 -1
@@ -987,7 +987,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)return device; err: -acpi_release_power_resource (&device->dev); +acpi_dev_put (device);return NULL ; }
drivers/acpi/scan.c +1 -1
@@ -1900,7 +1900,7 @@ static int acpi_add_single_object(struct acpi_device **child, result =acpi_device_add (device);if (result) { -acpi_device_release (&device->dev); +acpi_dev_put (device);return result; }
Sasha Levin
maintainerPATCH 1/1 ACPI: scan: Use acpi_dev_put() in object add error paths
From: Guangshuo Li <[email protected]>
[ Upstream commit 9c0acc169ac71535477caedea8315f7041c5f07c ]
After acpi_init_device_object(), the lifetime of struct acpi_device is managed by the driver core through reference counting.
Both acpi_add_power_resource() and acpi_add_single_object() call acpi_init_device_object() and then invoke acpi_device_add(). If that fails, their error paths call the release callback directly instead of dropping the device reference through acpi_dev_put().
This bypasses the normal device lifetime rules and frees the object without releasing the reference acquired by device_initialize(), which may lead to a refcount leak.
The issue was identified by a static analysis tool I developed and confirmed by manual review.
Fix both error paths by using acpi_dev_put() and let the release callback handle the final cleanup.
--- drivers/acpi/power.c | 2 +- drivers/acpi/scan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/power.c +1 -1
@@ -977,7 +977,7 @@ int acpi_add_power_resource(acpi_handle handle)return 0 ; err: -acpi_release_power_resource (&device->dev); +acpi_dev_put (device);return result; }
drivers/acpi/scan.c +1 -1
@@ -1679,7 +1679,7 @@ static int acpi_add_single_object(struct acpi_device **child, result =acpi_device_add (device, acpi_device_release);if (result) { -acpi_device_release (&device->dev); +acpi_dev_put (device);return result; }
Signature · 1 line
2.53.0