]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: utils: Fix reference counting in for_each_acpi_dev_match()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Mon, 12 Jul 2021 18:21:21 +0000 (21:21 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 19 Jul 2021 14:22:01 +0000 (16:22 +0200)
commit71f6428332844f38c7cb10461d9f29e9c9b983a0
treea3f548533d49a94a35d17a8661fb27a075355965
parent2734d6c1b1a089fb593ef6a23d4b70903526fe0c
ACPI: utils: Fix reference counting in for_each_acpi_dev_match()

Currently it's possible to iterate over the dangling pointer in case the device
suddenly disappears. This may happen becase callers put it at the end of a loop.

Instead, let's move that call inside acpi_dev_get_next_match_dev().

Fixes: 803abec64ef9 ("media: ipu3-cio2: Add cio2-bridge to ipu3-cio2 driver")
Fixes: bf263f64e804 ("media: ACPI / bus: Add acpi_dev_get_next_match_dev() and helper macro")
Fixes: edbd1bc4951e ("efi/dev-path-parser: Switch to use for_each_acpi_dev_match()")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Daniel Scally <djrscally@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/utils.c
drivers/firmware/efi/dev-path-parser.c
drivers/media/pci/intel/ipu3/cio2-bridge.c
include/acpi/acpi_bus.h