aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-02-11 09:22:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-21 18:38:49 -0500
commit94409cc1e507b157f8442dad80ff5e560c3205e5 (patch)
treee667c909f8da47694d2fbe9ca5eda4a4b86256cc
parent59036e94732edc2fb957465008c68bbcfc6736fa (diff)
USB: fix usb open suspend race in cdc-acm
this fixes a race between open and disconnect in the CDC ACM driver. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/class/cdc-acm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index bcc42136c93f..0147ea39340e 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -496,13 +496,10 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
496 otherwise it is scheduled, and with high data rates data can get lost. */ 496 otherwise it is scheduled, and with high data rates data can get lost. */
497 tty->low_latency = 1; 497 tty->low_latency = 1;
498 498
499 if (usb_autopm_get_interface(acm->control)) { 499 if (usb_autopm_get_interface(acm->control) < 0)
500 mutex_unlock(&open_mutex); 500 goto early_bail;
501 return -EIO;
502 }
503 501
504 mutex_lock(&acm->mutex); 502 mutex_lock(&acm->mutex);
505 mutex_unlock(&open_mutex);
506 if (acm->used++) { 503 if (acm->used++) {
507 usb_autopm_put_interface(acm->control); 504 usb_autopm_put_interface(acm->control);
508 goto done; 505 goto done;
@@ -536,6 +533,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
536done: 533done:
537err_out: 534err_out:
538 mutex_unlock(&acm->mutex); 535 mutex_unlock(&acm->mutex);
536 mutex_unlock(&open_mutex);
539 return rv; 537 return rv;
540 538
541full_bailout: 539full_bailout:
@@ -544,6 +542,8 @@ bail_out:
544 usb_autopm_put_interface(acm->control); 542 usb_autopm_put_interface(acm->control);
545 acm->used--; 543 acm->used--;
546 mutex_unlock(&acm->mutex); 544 mutex_unlock(&acm->mutex);
545early_bail:
546 mutex_unlock(&open_mutex);
547 return -EIO; 547 return -EIO;
548} 548}
549 549