[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7586985.G9YL5ver76@aspire.rjw.lan>
Date: Thu, 13 Dec 2018 19:27:47 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Martin Liu <liumartin@...gle.com>,
Alan Stern <stern@...land.harvard.edu>,
LKML <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Daniel Vetter <daniel.vetter@...ll.ch>
Subject: [PATCH] driver core: Add missing dev->bus->need_parent_lock checks
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
__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@...el.com>
---
This should go into -stable for everything over 4.18 methinks.
---
drivers/base/dd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-pm/drivers/base/dd.c
===================================================================
--- linux-pm.orig/drivers/base/dd.c
+++ linux-pm/drivers/base/dd.c
@@ -933,11 +933,11 @@ static void __device_release_driver(stru
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);
Powered by blists - more mailing lists