Skip to content

Commit e121a83

Browse files
rafaeljwgregkh
authored andcommitted
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: 8c97a46 (driver core: hold dev's parent lock when needed) Signed-off-by: Rafael J. Wysocki <[email protected]> Cc: stable <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent df44b47 commit e121a83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/base/dd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,11 @@ static void __device_release_driver(struct device *dev, struct device *parent)
933933
if (drv) {
934934
while (device_links_busy(dev)) {
935935
device_unlock(dev);
936-
if (parent)
936+
if (parent && dev->bus->need_parent_lock)
937937
device_unlock(parent);
938938

939939
device_links_unbind_consumers(dev);
940-
if (parent)
940+
if (parent && dev->bus->need_parent_lock)
941941
device_lock(parent);
942942

943943
device_lock(dev);

0 commit comments

Comments
 (0)