drivers/platform/x86/serdev_helpers.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace acpi_get_first_physical_node() that is slated for removal
with acpi_bus_get_primary_device() that takes a reference to the
device it is about to return.
This addresses a potential use-after-free that may occur if the
device returned by acpi_get_first_physical_node() is removed right
after dropping its ACPI companion's physical_node_lock in that
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/platform/x86/serdev_helpers.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/platform/x86/serdev_helpers.h b/drivers/platform/x86/serdev_helpers.h
index 57eac75805e2..20267e1941f1 100644
--- a/drivers/platform/x86/serdev_helpers.h
+++ b/drivers/platform/x86/serdev_helpers.h
@@ -74,8 +74,7 @@ get_serdev_controller(const char *serial_ctrl_hid,
return ERR_PTR(-ENODEV);
}
- /* get_first_physical_node() returns a weak ref */
- parent = get_device(acpi_get_first_physical_node(adev));
+ parent = acpi_bus_get_primary_device(adev);
acpi_dev_put(adev);
if (!parent) {
pr_err("error could not get %s/%s serial-ctrl physical node\n",
--
2.51.0
Hi,
On 21-Sep-26 21:49, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace acpi_get_first_physical_node() that is slated for removal
> with acpi_bus_get_primary_device() that takes a reference to the
> device it is about to return.
>
> This addresses a potential use-after-free that may occur if the
> device returned by acpi_get_first_physical_node() is removed right
> after dropping its ACPI companion's physical_node_lock in that
> function.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Regards,
Hans
> ---
> drivers/platform/x86/serdev_helpers.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/serdev_helpers.h b/drivers/platform/x86/serdev_helpers.h
> index 57eac75805e2..20267e1941f1 100644
> --- a/drivers/platform/x86/serdev_helpers.h
> +++ b/drivers/platform/x86/serdev_helpers.h
> @@ -74,8 +74,7 @@ get_serdev_controller(const char *serial_ctrl_hid,
> return ERR_PTR(-ENODEV);
> }
>
> - /* get_first_physical_node() returns a weak ref */
> - parent = get_device(acpi_get_first_physical_node(adev));
> + parent = acpi_bus_get_primary_device(adev);
> acpi_dev_put(adev);
> if (!parent) {
> pr_err("error could not get %s/%s serial-ctrl physical node\n",
On Mon, 21 Sep 2026, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace acpi_get_first_physical_node() that is slated for removal
> with acpi_bus_get_primary_device() that takes a reference to the
> device it is about to return.
>
> This addresses a potential use-after-free that may occur if the
> device returned by acpi_get_first_physical_node() is removed right
> after dropping its ACPI companion's physical_node_lock in that
> function.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/platform/x86/serdev_helpers.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/serdev_helpers.h b/drivers/platform/x86/serdev_helpers.h
> index 57eac75805e2..20267e1941f1 100644
> --- a/drivers/platform/x86/serdev_helpers.h
> +++ b/drivers/platform/x86/serdev_helpers.h
> @@ -74,8 +74,7 @@ get_serdev_controller(const char *serial_ctrl_hid,
> return ERR_PTR(-ENODEV);
> }
>
> - /* get_first_physical_node() returns a weak ref */
> - parent = get_device(acpi_get_first_physical_node(adev));
> + parent = acpi_bus_get_primary_device(adev);
> acpi_dev_put(adev);
> if (!parent) {
> pr_err("error could not get %s/%s serial-ctrl physical node\n",
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
© 2016 - 2026 Red Hat, Inc.