driver core: Do not resume suppliers under device_links_write_lock()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Feb 2019 00:47:53 +0000 (01:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Feb 2019 09:04:08 +0000 (10:04 +0100)
commit5db25c9eb893df8f6b93c1d97b8006d768e1b6f5
treeb4a98023165114a5539d9804089fb1f4493e4caa
parentf265df550a4350dce0a4d721a77c52e4b847ea40
driver core: Do not resume suppliers under device_links_write_lock()

It is incorrect to call pm_runtime_get_sync() under
device_links_write_lock(), because it may end up trying to take
device_links_read_lock() while resuming the target device and that
will deadlock in the non-SRCU case, so avoid that by resuming the
supplier device in device_link_add() before calling
device_links_write_lock().

Fixes: 21d5c57b3726 ("PM / runtime: Use device links")
Fixes: baa8809f6097 ("PM / runtime: Optimize the use of device links")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c