aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/class/cdc-acm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-11-18 07:37:51 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-11-18 07:37:51 -0800
commit2d5bc23b32e0ec6fe9c1cdd9f371063881dc1ffc (patch)
tree3203cf45058a8ce7ebc3c712fd872e0c85fd5ccc /drivers/usb/class/cdc-acm.c
parent78db1caa8ae4e549ffc0bbf0f9b52c113e9a4da0 (diff)
parentff854ce0b17161a86b5ae444c6cb0aa221720fab (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: USB: option.c: add support for D-Link DWM-162-U5 USB: usbmon: fix bug in mon_buff_area_shrink USB: xhci: Fix scratchpad deallocation. USB: xhci: Fix TRB physical to virtual address translation. USB: xhci: Fix bug memory free after failed initialization. USB: cdc_acm: Fix memory leak after hangup USB: cdc_acm: Fix race condition when opening tty USB: ohci: quirk AMD prefetch for USB 1.1 ISO transfer
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r--drivers/usb/class/cdc-acm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e3861b21e77..e4eca7810bc 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -609,9 +609,9 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
acm->throttle = 0;
- tasklet_schedule(&acm->urb_task);
set_bit(ASYNCB_INITIALIZED, &acm->port.flags);
rv = tty_port_block_til_ready(&acm->port, tty, filp);
+ tasklet_schedule(&acm->urb_task);
done:
mutex_unlock(&acm->mutex);
err_out:
@@ -686,15 +686,21 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
/* Perform the closing process and see if we need to do the hardware
shutdown */
- if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0)
+ if (!acm)
+ return;
+ if (tty_port_close_start(&acm->port, tty, filp) == 0) {
+ mutex_lock(&open_mutex);
+ if (!acm->dev) {
+ tty_port_tty_set(&acm->port, NULL);
+ acm_tty_unregister(acm);
+ tty->driver_data = NULL;
+ }
+ mutex_unlock(&open_mutex);
return;
+ }
acm_port_down(acm, 0);
tty_port_close_end(&acm->port, tty);
- mutex_lock(&open_mutex);
tty_port_tty_set(&acm->port, NULL);
- if (!acm->dev)
- acm_tty_unregister(acm);
- mutex_unlock(&open_mutex);
}
static int acm_tty_write(struct tty_struct *tty,