Skip to content

Commit

Permalink
driver core: Add missing dev->bus->need_parent_lock checks
Browse files Browse the repository at this point in the history
__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: 8c97a46 (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>
  • Loading branch information
rafaeljw authored and gregkh committed Dec 19, 2018
1 parent df44b47 commit e121a83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e121a83

Please sign in to comment.