* [PATCH] driver core: Add missing dev->bus->need_parent_lock checks
@ 2018-12-13 18:27 Rafael J. Wysocki
2018-12-13 18:53 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2018-12-13 18:27 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Martin Liu, Alan Stern, LKML, Linux PM, Daniel Vetter
From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.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);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] driver core: Add missing dev->bus->need_parent_lock checks
2018-12-13 18:27 [PATCH] driver core: Add missing dev->bus->need_parent_lock checks Rafael J. Wysocki
@ 2018-12-13 18:53 ` Greg Kroah-Hartman
2018-12-13 19:06 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-13 18:53 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Martin Liu, Alan Stern, LKML, Linux PM, Daniel Vetter
On Thu, Dec 13, 2018 at 07:27:47PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.com>
> ---
>
> This should go into -stable for everything over 4.18 methinks.
Does this fix Daniel's lockdep splat?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: Add missing dev->bus->need_parent_lock checks
2018-12-13 18:53 ` Greg Kroah-Hartman
@ 2018-12-13 19:06 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2018-12-13 19:06 UTC (permalink / raw)
To: Greg KH
Cc: Rafael J. Wysocki, liumartin, Alan Stern,
Linux Kernel Mailing List, Linux PM list
On Thu, Dec 13, 2018 at 7:53 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Dec 13, 2018 at 07:27:47PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.com>
> > ---
> >
> > This should go into -stable for everything over 4.18 methinks.
>
> Does this fix Daniel's lockdep splat?
Nah, separate issue. Afaiui bus->need_parent_lock is only set for usb,
I'm unbinding pci devices. I guess the combination of someone
unbinding an usb device through sysfs which also has some device links
attached doesn't happen.
Since I've dug around in this, for this patch here from Rafael:
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cheers, Daniel
>
> thanks,
>
> greg k-h
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-13 19:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 18:27 [PATCH] driver core: Add missing dev->bus->need_parent_lock checks Rafael J. Wysocki
2018-12-13 18:53 ` Greg Kroah-Hartman
2018-12-13 19:06 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®