aboutsummaryrefslogtreecommitdiffstats
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2008-10-22 09:18:04 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-22 09:18:04 -0700
commit255ec7bec9a1b7ee5115ac95ab3123a6b4296ca6 (patch)
treed88ec73609c49927e093ec7eb309de922a9160c8
parent9b96c3fc6baaebb0350886a9aac15c4482e1a9c0 (diff)
downloadpatches-255ec7bec9a1b7ee5115ac95ab3123a6b4296ca6.tar.gz
usb fixes added
-rw-r--r--series2
-rw-r--r--usb.current/usb-don-t-rebind-drivers-after-failed-resume-or-reset.patch52
-rw-r--r--usb.current/usb-fix-memory-leak-in-cdc-acm.patch37
3 files changed, 91 insertions, 0 deletions
diff --git a/series b/series
index 3574243e416389..7288249891160c 100644
--- a/series
+++ b/series
@@ -29,6 +29,8 @@ usb.current/usb-gadget-fix-kernel-doc-warning.patch
usb.current/usb-fix-unneeded-endpoint-check-in-pxa27x_udc.patch
usb.current/usb-cdc-wdm-make-module-autoload-work.patch
usb.current/usb-unusual-dev-for-mio-moov-330-gps.patch
+usb.current/usb-fix-memory-leak-in-cdc-acm.patch
+usb.current/usb-don-t-rebind-drivers-after-failed-resume-or-reset.patch
#####################################################################
diff --git a/usb.current/usb-don-t-rebind-drivers-after-failed-resume-or-reset.patch b/usb.current/usb-don-t-rebind-drivers-after-failed-resume-or-reset.patch
new file mode 100644
index 00000000000000..8a7dca3e2f180a
--- /dev/null
+++ b/usb.current/usb-don-t-rebind-drivers-after-failed-resume-or-reset.patch
@@ -0,0 +1,52 @@
+From stern@rowland.harvard.edu Wed Oct 22 09:08:59 2008
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Tue, 21 Oct 2008 15:40:03 -0400 (EDT)
+Subject: USB: don't rebind drivers after failed resume or reset
+To: Greg KH <greg@kroah.com>
+Cc: USB list <linux-usb@vger.kernel.org>
+Message-ID: <Pine.LNX.4.44L0.0810211534150.2995-100000@iolanthe.rowland.org>
+
+
+This patch (as1152) may help prevent some problems associated with the
+new policy of unbinding drivers that don't support suspend/resume or
+pre_reset/post_reset. If for any reason the resume or reset fails, and
+the device is logically disconnected, there's no point in trying to
+rebind the driver. So the patch checks for success before carrying
+out the unbind/rebind.
+
+There was a report from one user that this fixed a problem he was
+experiencing, but the details never became fully clear. In any case,
+adding these tests can't hurt.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/driver.c | 3 ++-
+ drivers/usb/core/hub.c | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/core/driver.c
++++ b/drivers/usb/core/driver.c
+@@ -1610,7 +1610,8 @@ int usb_external_resume_device(struct us
+ status = usb_resume_both(udev);
+ udev->last_busy = jiffies;
+ usb_pm_unlock(udev);
+- do_unbind_rebind(udev, DO_REBIND);
++ if (status == 0)
++ do_unbind_rebind(udev, DO_REBIND);
+
+ /* Now that the device is awake, we can start trying to autosuspend
+ * it again. */
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -3504,7 +3504,7 @@ int usb_reset_device(struct usb_device *
+ USB_INTERFACE_BOUND)
+ rebind = 1;
+ }
+- if (rebind)
++ if (ret == 0 && rebind)
+ usb_rebind_intf(cintf);
+ }
+ }
diff --git a/usb.current/usb-fix-memory-leak-in-cdc-acm.patch b/usb.current/usb-fix-memory-leak-in-cdc-acm.patch
new file mode 100644
index 00000000000000..ddc446352f3f92
--- /dev/null
+++ b/usb.current/usb-fix-memory-leak-in-cdc-acm.patch
@@ -0,0 +1,37 @@
+From oliver@neukum.org Wed Oct 22 09:07:58 2008
+From: Oliver Neukum <oliver@neukum.org>
+Date: Tue, 21 Oct 2008 10:39:04 +0200
+Subject: USB: fix memory leak in cdc-acm
+To: Greg KH <greg@kroah.com>
+Cc: linux-usb@vger.kernel.org
+Message-ID: <200810211039.05127.oliver@neukum.org>
+Content-Disposition: inline
+
+
+This fixes a memory leak on disconnect in cdc-acm
+
+Thanks to 施金前 for finding it.
+
+Signed-off-by: Oliver Neukum <oneukum@suse.de>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/class/cdc-acm.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -849,9 +849,10 @@ static void acm_write_buffers_free(struc
+ {
+ int i;
+ struct acm_wb *wb;
++ struct usb_device *usb_dev = interface_to_usbdev(acm->control);
+
+ for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) {
+- usb_buffer_free(acm->dev, acm->writesize, wb->buf, wb->dmah);
++ usb_buffer_free(usb_dev, acm->writesize, wb->buf, wb->dmah);
+ }
+ }
+