]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: bus: Avoid non-ACPI device objects in walks over children
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 22 Apr 2022 15:13:48 +0000 (17:13 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 22 Apr 2022 16:19:44 +0000 (18:19 +0200)
commit165c40ec73666c728bef5bdd1c008dbff1469ff8
tree24b79e53caad2d44d8f7bfdf907ec1f0d7f00592
parent8b468b5b5698d16104f8b594b86e7ec4dc0c9e74
ACPI: bus: Avoid non-ACPI device objects in walks over children

When walking the children of an ACPI device, take extra care to avoid
using to_acpi_device() on the ones that are not ACPI devices, because
that may lead to out-of-bounds access and memory corruption.

While at it, make the function passed to acpi_dev_for_each_child()
take a struct acpi_device pointer argument (instead of a struct device
one), so it is more straightforward to use.

Fixes: 6a7c2063a737 ("ACPI: PM: Introduce acpi_dev_power_up_children_with_adr()")
Reported-by: kernel test robot <oliver.sang@intel.com>
BugLink: https://lore.kernel.org/lkml/20220420064725.GB16310@xsang-OptiPlex-9020/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/bus.c
drivers/acpi/device_pm.c
include/acpi/acpi_bus.h