Commit 10d25b76 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] USB: fix bug in acm's open function

Here's a patch for 2.6.11-rc5 that a lot of cdc-acm driver users are
clamoring for.

There's a bug introduced in a cleanup which will lead to a race making
reopenings fail.  This fix is by Alexander Lykanov.
Signed-off-by: default avatarOliver Neukum <oliver@neukum.name>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9dffa35e
......@@ -278,15 +278,14 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
if (acm->used) {
if (acm->used++) {
goto done;
}
acm->ctrlurb->dev = acm->dev;
if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) {
dbg("usb_submit_urb(ctrl irq) failed");
rv = -EIO;
goto err_out;
goto bail_out;
}
acm->readurb->dev = acm->dev;
......@@ -303,7 +302,6 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
tty->low_latency = 1;
done:
acm->used++;
err_out:
up(&open_sem);
return rv;
......@@ -312,6 +310,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
usb_kill_urb(acm->readurb);
bail_out_and_unlink:
usb_kill_urb(acm->ctrlurb);
bail_out:
acm->used--;
up(&open_sem);
return -EIO;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment