linux-stable/drivers/base
Rafael J. Wysocki c1567f813a PM-runtime: Fix __pm_runtime_set_status() race with runtime resume
Commit 4080ab0830 ("PM-runtime: Take suppliers into account in
__pm_runtime_set_status()") introduced a race condition that may
trigger if __pm_runtime_set_status() is used incorrectly (that is,
if it is called when PM-runtime is enabled for the target device
and working).

In that case, if the original PM-runtime status of the device is
RPM_SUSPENDED, a runtime resume of the device may occur after
__pm_runtime_set_status() has dropped its power.lock spinlock
and before deactivating its suppliers, so the suppliers may be
deactivated while the device is PM-runtime-active which may lead
to functional issues.

To avoid that, modify __pm_runtime_set_status() to check whether
or not PM-runtime is enabled for the device before activating its
suppliers (if the new status is RPM_ACTIVE) and either return an
error if that's the case or increment the device's disable_depth
counter to prevent PM-runtime from being enabled for it while
the remaining part of the function is running (disable_depth is
then decremented on the way out).

Fixes: 4080ab0830 ("PM-runtime: Take suppliers into account in __pm_runtime_set_status()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-13 09:09:51 +01:00
..
firmware_loader firmware_loader: move firmware/ to drivers/base/firmware_loader/builtin/ 2019-01-22 10:23:18 +01:00
power PM-runtime: Fix __pm_runtime_set_status() race with runtime resume 2019-02-13 09:09:51 +01:00
regmap regmap-irq: do not write mask register if mask_base is zero 2019-01-14 22:11:22 +00:00
test driver core: Rewrite test_async_driver_probe to cover serialization and NUMA affinity 2019-01-31 14:20:54 +01:00
arch_topology.c sched/topology, drivers/base/arch_topology: Rebuild the sched_domain hierarchy when capacities change 2018-09-10 11:05:47 +02:00
attribute_container.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
base.h driver core: Probe devices asynchronously instead of the driver 2019-01-31 14:20:53 +01:00
bus.c driver core: Probe devices asynchronously instead of the driver 2019-01-31 14:20:53 +01:00
cacheinfo.c cacheinfo: Keep the old value if of_property_read_u32 fails 2019-01-22 13:50:31 +01:00
class.c driver core: move device->knode_class to device_private 2019-01-18 16:55:48 +01:00
component.c components: multiple components for a device 2019-02-08 16:58:03 +01:00
container.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
core.c driver core: Add device link flag DL_FLAG_AUTOPROBE_CONSUMER 2019-02-01 10:04:08 +01:00
cpu.c drivers: base: Use __printf markup to silence compiler 2019-01-31 19:28:40 +01:00
dd.c driver core: Postpone DMA tear-down until after devres release 2019-02-08 12:56:33 +01:00
devcon.c drivers: base: Unified device connection lookup 2018-03-22 13:10:29 +01:00
devcoredump.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
devres.c devres: Align data[] to ARCH_KMALLOC_MINALIGN 2018-11-11 11:40:04 -08:00
devtmpfs.c vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled 2018-12-20 16:32:56 +00:00
driver.c driver-core: return EINVAL error instead of BUG_ON() 2018-05-25 18:18:45 +02:00
firmware.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
hypervisor.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
init.c base: fix order of OF initialization 2018-07-07 17:54:29 +02:00
isa.c Merge 4.15-rc3 into driver-core-next 2017-12-11 08:50:05 +01:00
Kconfig firmware_loader: move kconfig FW_LOADER entries to its own file 2018-05-14 16:43:10 +02:00
Makefile drivers: base: Introducing software nodes to the firmware node framework 2018-11-26 18:19:11 +01:00
map.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
memory.c Driver core patches for 4.21-rc1 2018-12-28 20:44:29 -08:00
module.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
node.c mm, proc: add KReclaimable to /proc/meminfo 2018-10-26 16:26:32 -07:00
pinctrl.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
platform-msi.c platform-msi: Free descriptors in platform_msi_domain_free() 2018-12-13 09:35:31 +00:00
platform.c driver: platform: Support parsing GpioInt 0 in platform_get_irq() 2019-02-12 10:36:49 +01:00
property.c device property: fix fwnode_graph_get_next_endpoint() documentation 2018-12-18 23:39:45 +01:00
soc.c base: soc: use put_device() instead of kfree() 2018-03-15 14:37:03 +01:00
swnode.c drivers: base: swnode: check if swnode is NULL before dereferencing it 2018-12-26 10:50:36 +01:00
syscore.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
topology.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
transport_class.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00