All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: fix bug in acm's open function
@ 2005-02-25  0:11 Greg KH
  0 siblings, 0 replies; only message in thread
From: Greg KH @ 2005-02-25  0:11 UTC (permalink / raw)
  To: torvalds, Andrew Morton; +Cc: Oliver Neukum, linux-usb-devel, linux-kernel

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@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-25  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-25  0:11 [PATCH] USB: fix bug in acm's open function Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.