[PATCH v1 05/17] platform/x86: yogabook: Switch to use acpi_bus_get_primary_device()
Mark Pearson
mpearson-lenovo at squebb.ca
Tue Sep 22 08:34:44 PDT 2026
On Mon, Sep 21, 2026, at 3:48 PM, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki at 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 at intel.com>
> ---
> drivers/platform/x86/lenovo/yogabook.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo/yogabook.c
> b/drivers/platform/x86/lenovo/yogabook.c
> index 1a4b2ab1f35d..8a91d440724b 100644
> --- a/drivers/platform/x86/lenovo/yogabook.c
> +++ b/drivers/platform/x86/lenovo/yogabook.c
> @@ -353,13 +353,13 @@ static int yogabook_wmi_probe(struct wmi_device
> *wdev, const void *context)
> goto error_put_devs;
> }
>
> - data->kbd_dev = get_device(acpi_get_first_physical_node(data->kbd_adev));
> + data->kbd_dev = acpi_bus_get_primary_device(data->kbd_adev);
> if (!data->kbd_dev || !data->kbd_dev->driver) {
> r = -EPROBE_DEFER;
> goto error_put_devs;
> }
>
> - data->dig_dev = get_device(acpi_get_first_physical_node(data->dig_adev));
> + data->dig_dev = acpi_bus_get_primary_device(data->dig_adev);
> if (!data->dig_dev || !data->dig_dev->driver) {
> r = -EPROBE_DEFER;
> goto error_put_devs;
> --
> 2.51.0
Reviewed-by: Mark Pearson <mpearson-lenovo at squebb.ca>
Mark
More information about the linux-arm-kernel
mailing list