The driver uses udev as a flag. Some functions using it hold
the global mutex and other the device's mutex. Setting it to
NULL requires both mutexes to be held.

Signed-off-by: Oliver Neukum <[email protected]>
Fixes: f08812d5eb8f8 ("USB: FIx locks and urb->status in adutux (updated)")
Reported-by: Anton Volkov <[email protected]>
---
 drivers/usb/misc/adutux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 869b28891bd3..e980842f4afb 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -765,13 +765,13 @@ static void adu_disconnect(struct usb_interface 
*interface)
 
        dev = usb_get_intfdata(interface);
 
+       mutex_lock(&adutux_mutex);
        mutex_lock(&dev->mtx);  /* not interruptible */
        dev->udev = NULL;       /* poison */
        minor = dev->minor;
        usb_deregister_dev(interface, &adu_class);
        mutex_unlock(&dev->mtx);
 
-       mutex_lock(&adutux_mutex);
        usb_set_intfdata(interface, NULL);
 
        /* if the device is not opened, then we clean up right now */
-- 
2.12.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to