[PATCH] USB: fix bug in acm's open function
From: Greg KH
Date: Thu Feb 24 2005 - 19:29:45 EST
Here's a patch for 2.6.11-rc5 that a lot of cdc-acm driver users are
clammering 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: Oliver Neukum <oliver@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c 2005-02-19 10:02:21 +01:00
+++ b/drivers/usb/class/cdc-acm.c 2005-02-19 10:02:21 +01:00
@@ -278,15 +278,14 @@
- 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 @@
tty->low_latency = 1;
done:
- acm->used++;
err_out:
up(&open_sem);
return rv;
@@ -312,6 +310,8 @@
usb_kill_urb(acm->readurb);
bail_out_and_unlink:
usb_kill_urb(acm->ctrlurb);
+bail_out:
+ acm->used--;
up(&open_sem);
return -EIO;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/