All of lore.kernel.org
 help / color / mirror / Atom feed
* patch "driver core: Add missing dev->bus->need_parent_lock checks" added to driver-core-next
@ 2018-12-19 16:38 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2018-12-19 16:38 UTC (permalink / raw)
  To: rafael.j.wysocki, daniel.vetter, gregkh, stable


This is a note to let you know that I've just added the patch titled

    driver core: Add missing dev->bus->need_parent_lock checks

to my driver-core git tree which can be found at
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From e121a833745b4708b660e3fe6776129c2956b041 Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Date: Thu, 13 Dec 2018 19:27:47 +0100
Subject: 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>
---
 drivers/base/dd.c | 4 ++--
 1 file 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);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-19 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 16:38 patch "driver core: Add missing dev->bus->need_parent_lock checks" added to driver-core-next gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.