* [char-misc 4.2] mei: nfc: fix deadlock on shutdown/suspend path
@ 2015-07-07 21:22 Tomas Winkler
2015-07-07 21:40 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Tomas Winkler @ 2015-07-07 21:22 UTC (permalink / raw)
To: Greg Kroah-Hartman, Linus Torvalds
Cc: arnd, Alexander Usyskin, linux-kernel, Tomas Winkler,
Samuel Ortiz
In function mei_nfc_host_exit mei_cl_remove_device cannot be called
under the device mutex as device removing flow invokes the device driver
remove handler that calls in turn to mei_cl_disable_device which
naturally acquires the device mutex.
Also remove mei_cl_bus_remove_devices which has the same issue, but is
never executed as currently the only device on the mei client bus is
NFC and a new device cannot be easily added till
the bus revamp is completed.
This fixes regression caused by commit
be9b720a0ccba096d669bc86634f900b82b9bf71
Author: Tomas Winkler <tomas.winkler@intel.com>
Date: Thu May 7 15:54:04 2015 +0300
NFC: mei_phy: move all nfc logic from mei driver to nfc
Prior to this change the nfc driver remove handler
called to no-op disable function while actual nfc
device was disabled directly from the mei driver.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
drivers/misc/mei/bus.c | 16 ----------------
drivers/misc/mei/init.c | 2 --
drivers/misc/mei/nfc.c | 3 ++-
3 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 357b6ae4d207..458aa5a09c52 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -552,22 +552,6 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)
schedule_work(&device->event_work);
}
-void mei_cl_bus_remove_devices(struct mei_device *dev)
-{
- struct mei_cl *cl, *next;
-
- mutex_lock(&dev->device_lock);
- list_for_each_entry_safe(cl, next, &dev->device_list, device_link) {
- if (cl->device)
- mei_cl_remove_device(cl->device);
-
- list_del(&cl->device_link);
- mei_cl_unlink(cl);
- kfree(cl);
- }
- mutex_unlock(&dev->device_lock);
-}
-
int __init mei_cl_bus_init(void)
{
return bus_register(&mei_cl_bus_type);
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 94514b2c7a50..00c3865ca3b1 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -333,8 +333,6 @@ void mei_stop(struct mei_device *dev)
mei_nfc_host_exit(dev);
- mei_cl_bus_remove_devices(dev);
-
mutex_lock(&dev->device_lock);
mei_wd_stop(dev);
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index b983c4ecad38..290ef3037437 100644
--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -402,11 +402,12 @@ void mei_nfc_host_exit(struct mei_device *dev)
cldev->priv_data = NULL;
- mutex_lock(&dev->device_lock);
/* Need to remove the device here
* since mei_nfc_free will unlink the clients
*/
mei_cl_remove_device(cldev);
+
+ mutex_lock(&dev->device_lock);
mei_nfc_free(ndev);
mutex_unlock(&dev->device_lock);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [char-misc 4.2] mei: nfc: fix deadlock on shutdown/suspend path
2015-07-07 21:22 [char-misc 4.2] mei: nfc: fix deadlock on shutdown/suspend path Tomas Winkler
@ 2015-07-07 21:40 ` Linus Torvalds
2015-07-07 22:00 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2015-07-07 21:40 UTC (permalink / raw)
To: Tomas Winkler
Cc: Greg Kroah-Hartman, Arnd Bergmann, Alexander Usyskin,
Linux Kernel Mailing List, Samuel Ortiz
On Tue, Jul 7, 2015 at 2:22 PM, Tomas Winkler <tomas.winkler@intel.com> wrote:
> In function mei_nfc_host_exit mei_cl_remove_device cannot be called
> under the device mutex as device removing flow invokes the device driver
> remove handler that calls in turn to mei_cl_disable_device which
> naturally acquires the device mutex.
Yup, tested and confirmed. This patch fixes things for me without the
revert. Thanks.
Greg, should I just apply it directly, or do we go through your tree?
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [char-misc 4.2] mei: nfc: fix deadlock on shutdown/suspend path
2015-07-07 21:40 ` Linus Torvalds
@ 2015-07-07 22:00 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2015-07-07 22:00 UTC (permalink / raw)
To: Linus Torvalds
Cc: Tomas Winkler, Arnd Bergmann, Alexander Usyskin,
Linux Kernel Mailing List, Samuel Ortiz
On Tue, Jul 07, 2015 at 02:40:13PM -0700, Linus Torvalds wrote:
> On Tue, Jul 7, 2015 at 2:22 PM, Tomas Winkler <tomas.winkler@intel.com> wrote:
> > In function mei_nfc_host_exit mei_cl_remove_device cannot be called
> > under the device mutex as device removing flow invokes the device driver
> > remove handler that calls in turn to mei_cl_disable_device which
> > naturally acquires the device mutex.
>
> Yup, tested and confirmed. This patch fixes things for me without the
> revert. Thanks.
>
> Greg, should I just apply it directly, or do we go through your tree?
Feel free to take it directly, that way it fixes your laptop now, I
don't have any other pending char-misc patches at the moment.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-07 22:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07 21:22 [char-misc 4.2] mei: nfc: fix deadlock on shutdown/suspend path Tomas Winkler
2015-07-07 21:40 ` Linus Torvalds
2015-07-07 22:00 ` Greg Kroah-Hartman
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.