@@ -704,6 +704,7 @@ static int wdm_open(struct inode *inode, struct file *file)
/* using write lock to protect desc->count */
mutex_lock(&desc->wlock);
+ mutex_unlock(&wdm_mutex);
if (!desc->count++) {
/* in case flush() had timed out */
usb_kill_urb(desc->command);
@@ -716,13 +717,14 @@ static int wdm_open(struct inode *inode, struct file *file)
"Error submitting int urb - %d\n", rv);
rv = usb_translate_errors(rv);
}
+ if (desc->count == 1)
+ desc->manage_power(intf, 1);
} else {
rv = 0;
}
mutex_unlock(&desc->wlock);
- if (desc->count == 1)
- desc->manage_power(intf, 1);
usb_autopm_put_interface(desc->intf);
+ return rv;
out:
mutex_unlock(&wdm_mutex);
return rv;
Use the global mutex for as short as possible in open() Signed-off-by: Oliver Neukum <oneukum@suse.com> --- drivers/usb/class/cdc-wdm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)