[044/119] USB: cdc_acm: Fix race condition when opening tty

Greg KH
2009-12-07T00:29:49Z

[-- Attachment #1: usb-cdc_acm-fix-race-condition-when-opening-tty.patch --]
[-- Type: text/plain, Size: 970 bytes --]

2.6.31-stable review patch. If anyone has any objections, please let us know.

------------------
From: Henry Gebhardt <gebhardt@astro.uni-tuebingen.de>

commit 18a77b5d237a67d2c621a46f5271a3b51da1b380 upstream.

If acm_rx_tasklet() gets called before tty_port_block_til_ready()
returns, then bulk IN urbs may not be sent. This fixes it.

Signed-off-by: Henry Gebhardt <gebhardt@astro.uni-tuebingen.de>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
drivers/usb/class/cdc-acm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- 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_struc

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);