mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: torvalds@osdl.org, Andrew Morton <akpm@osdl.org>
Cc: Oliver Neukum <oliver@neukum.org>,
	linux-usb-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH] USB: fix bug in acm's open function
Date: Thu, 24 Feb 2005 16:11:50 -0800	[thread overview]
Message-ID: <20050225001150.GA27481@kroah.com> (raw)

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



                 reply	other threads:[~2005-02-25  0:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050225001150.GA27481@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oliver@neukum.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®