aboutsummaryrefslogtreecommitdiffstats
path: root/pending
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2009-07-28 10:41:30 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-07-28 10:41:30 -0700
commit078ab6446f8a0b8391aca88fa85f087f47de2183 (patch)
tree250162e882b62b0e55e8f6e9bebacc83490f2b81 /pending
parent3b615c5608e249ca355898353a0d7b06236827b3 (diff)
downloadpatches-078ab6446f8a0b8391aca88fa85f087f47de2183.tar.gz
more patches
Diffstat (limited to 'pending')
-rw-r--r--pending/usb-fix-usage-count-in-usb-serial-generic-open-regarding-autoresume.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/pending/usb-fix-usage-count-in-usb-serial-generic-open-regarding-autoresume.patch b/pending/usb-fix-usage-count-in-usb-serial-generic-open-regarding-autoresume.patch
new file mode 100644
index 00000000000000..71bff70ea2a4af
--- /dev/null
+++ b/pending/usb-fix-usage-count-in-usb-serial-generic-open-regarding-autoresume.patch
@@ -0,0 +1,60 @@
+From oliver@neukum.org Sat Jul 18 15:45:44 2009
+From: Oliver Neukum <oliver@neukum.org>
+Date: Sat, 18 Jul 2009 15:47:17 +0200
+Subject: USB: fix usage count in usb serial generic open regarding autoresume
+To: Matthew Garrett <mjg59@srcf.ucam.org>, Greg KH <greg@kroah.com>, Alan Stern <stern@rowland.harvard.edu>, linux-usb@vger.kernel.org
+Message-ID: <200907181547.17813.oliver@neukum.org>
+Content-Disposition: inline
+
+
+The resume handler has to resubmit the reading URBs if the device is
+resumed while opened. But the open() method bumps the counter before
+it resumes a device. The fix is to increment the counter only after
+the resumption or if no resumption is attempted.
+
+Signed-off-by: Oliver Neukum <oliver@neukum.org>
+Tested-by: Matthew Garrett <mjg@redhat.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/serial/usb-serial.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/serial/usb-serial.c
++++ b/drivers/usb/serial/usb-serial.c
+@@ -214,15 +214,13 @@ static int serial_open (struct tty_struc
+ goto bailout_port_put;
+ }
+
+- ++port->port.count;
+-
+ /* set up our port structure making the tty driver
+ * remember our port object, and us it */
+ tty->driver_data = port;
+ tty_port_tty_set(&port->port, tty);
+
+ /* If the console is attached, the device is already open */
+- if (port->port.count == 1 && !port->console) {
++ if (!port->port.count && !port->console) {
+
+ /* lock this module before we call it
+ * this may fail, which means we must bail out,
+@@ -240,12 +238,16 @@ static int serial_open (struct tty_struc
+ if (retval)
+ goto bailout_module_put;
+
++ ++port->port.count;
++
+ /* only call the device specific open if this
+ * is the first time the port is opened */
+ retval = serial->type->open(tty, port, filp);
+ if (retval)
+ goto bailout_interface_put;
+ mutex_unlock(&serial->disc_mutex);
++ } else {
++ ++port->port.count;
+ }
+ mutex_unlock(&port->mutex);
+ /* Now do the correct tty layer semantics */