From: Greg Kroah-Hartman Date: Wed, 26 Feb 2020 08:51:01 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.4.215~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=257740c72758aab4218d506fb31c975197326900;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: xhci-force-maximum-packet-size-for-full-speed-bulk-devices-to-valid-range.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index 1bdab01e980..a2964313215 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -118,3 +118,4 @@ floppy-check-fdc-index-for-errors-before-assigning-it.patch vt-selection-handle-pending-signals-in-paste_selection.patch staging-android-ashmem-disallow-ashmem-memory-from-being-remapped.patch staging-vt6656-fix-sign-of-rx_dbm-to-bb_pre_ed_rssi.patch +xhci-force-maximum-packet-size-for-full-speed-bulk-devices-to-valid-range.patch diff --git a/queue-4.9/xhci-force-maximum-packet-size-for-full-speed-bulk-devices-to-valid-range.patch b/queue-4.9/xhci-force-maximum-packet-size-for-full-speed-bulk-devices-to-valid-range.patch new file mode 100644 index 00000000000..0b55c5c2d86 --- /dev/null +++ b/queue-4.9/xhci-force-maximum-packet-size-for-full-speed-bulk-devices-to-valid-range.patch @@ -0,0 +1,51 @@ +From f148b9f402ef002b57bcff3964d45abc8ffb6c3f Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Mon, 10 Feb 2020 15:45:50 +0200 +Subject: xhci: Force Maximum Packet size for Full-speed bulk devices to valid range. + +From: Mathias Nyman + +commit f148b9f402ef002b57bcff3964d45abc8ffb6c3f upstream. + +A Full-speed bulk USB audio device (DJ-Tech CTRL) with a invalid Maximum +Packet Size of 4 causes a xHC "Parameter Error" at enumeration. + +This is because valid Maximum packet sizes for Full-speed bulk endpoints +are 8, 16, 32 and 64 bytes. Hosts are not required to support other values +than these. See usb 2 specs section 5.8.3 for details. + +The device starts working after forcing the maximum packet size to 8. +This is most likely the case with other devices as well, so force the +maximum packet size to a valid range. + +Cc: stable@vger.kernel.org +Reported-by: Rene D Obermueller +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20200210134553.9144-2-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci-mem.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/xhci-mem.c ++++ b/drivers/usb/host/xhci-mem.c +@@ -1532,9 +1532,15 @@ int xhci_endpoint_init(struct xhci_hcd * + /* Allow 3 retries for everything but isoc, set CErr = 3 */ + if (!usb_endpoint_xfer_isoc(&ep->desc)) + err_count = 3; +- /* Some devices get this wrong */ +- if (usb_endpoint_xfer_bulk(&ep->desc) && udev->speed == USB_SPEED_HIGH) +- max_packet = 512; ++ /* HS bulk max packet should be 512, FS bulk supports 8, 16, 32 or 64 */ ++ if (usb_endpoint_xfer_bulk(&ep->desc)) { ++ if (udev->speed == USB_SPEED_HIGH) ++ max_packet = 512; ++ if (udev->speed == USB_SPEED_FULL) { ++ max_packet = rounddown_pow_of_two(max_packet); ++ max_packet = clamp_val(max_packet, 8, 64); ++ } ++ } + /* xHCI 1.0 and 1.1 indicates that ctrl ep avg TRB Length should be 8 */ + if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version >= 0x100) + avg_trb_len = 8;