diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-12-13 19:27:47 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-19 10:08:34 +0100 |
commit | e121a833745b4708b660e3fe6776129c2956b041 (patch) | |
tree | 257a38b7dab8b8b141c12d0a28cc7524f5320871 /drivers | |
parent | df44b479654f62b478c18ee4d8bc4e9f897a9844 (diff) | |
download | linux-e121a833745b4708b660e3fe6776129c2956b041.tar.bz2 |
driver core: Add missing dev->bus->need_parent_lock checks
__device_release_driver() has to check dev->bus->need_parent_lock
before dropping the parent lock and acquiring it again as it may
attempt to drop a lock that hasn't been acquired or lock a device
that shouldn't be locked and create a lock imbalance.
Fixes: 8c97a46af04b (driver core: hold dev's parent lock when needed)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/dd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 88713f182086..8ac10af17c00 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -933,11 +933,11 @@ static void __device_release_driver(struct device *dev, struct device *parent) if (drv) { while (device_links_busy(dev)) { device_unlock(dev); - if (parent) + if (parent && dev->bus->need_parent_lock) device_unlock(parent); device_links_unbind_consumers(dev); - if (parent) + if (parent && dev->bus->need_parent_lock) device_lock(parent); device_lock(dev); |