include/linux/apple-gmux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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>
---
include/linux/apple-gmux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/apple-gmux.h b/include/linux/apple-gmux.h
index 206d97ffda79..d7939c3a08fd 100644
--- a/include/linux/apple-gmux.h
+++ b/include/linux/apple-gmux.h
@@ -109,7 +109,7 @@ static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, enum apple_gmux_ty
if (!adev)
return false;
- dev = get_device(acpi_get_first_physical_node(adev));
+ dev = acpi_bus_get_primary_device(adev);
acpi_dev_put(adev);
if (!dev)
return false;
--
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 > --- > include/linux/apple-gmux.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/apple-gmux.h b/include/linux/apple-gmux.h > index 206d97ffda79..d7939c3a08fd 100644 > --- a/include/linux/apple-gmux.h > +++ b/include/linux/apple-gmux.h > @@ -109,7 +109,7 @@ static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, enum apple_gmux_ty > if (!adev) > return false; > > - dev = get_device(acpi_get_first_physical_node(adev)); > + dev = acpi_bus_get_primary_device(adev); > acpi_dev_put(adev); > if (!dev) > return false;
© 2016 - 2026 Red Hat, Inc.