From: Greg Kroah-Hartman Date: Sun, 29 Aug 2021 07:04:36 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.4.283~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eaace3ed50d409f2ef79cc63167c2876ee8d85cd;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: can-usb-esd_usb2-esd_usb2_rx_event-fix-the-interchange-of-the-can-rx-and-tx-error-counters.patch revert-usb-serial-ch341-fix-character-loss-at-high-transfer-rates.patch usb-dwc3-gadget-fix-dwc3_calc_trbs_left.patch usb-dwc3-gadget-stop-ep0-transfers-during-pullup-disable.patch usb-serial-option-add-new-vid-pid-to-support-fibocom-fg150.patch --- diff --git a/queue-4.19/can-usb-esd_usb2-esd_usb2_rx_event-fix-the-interchange-of-the-can-rx-and-tx-error-counters.patch b/queue-4.19/can-usb-esd_usb2-esd_usb2_rx_event-fix-the-interchange-of-the-can-rx-and-tx-error-counters.patch new file mode 100644 index 00000000000..5ae44bddf99 --- /dev/null +++ b/queue-4.19/can-usb-esd_usb2-esd_usb2_rx_event-fix-the-interchange-of-the-can-rx-and-tx-error-counters.patch @@ -0,0 +1,40 @@ +From 044012b52029204900af9e4230263418427f4ba4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20M=C3=A4tje?= +Date: Wed, 25 Aug 2021 23:52:27 +0200 +Subject: can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Stefan Mätje + +commit 044012b52029204900af9e4230263418427f4ba4 upstream. + +This patch fixes the interchanged fetch of the CAN RX and TX error +counters from the ESD_EV_CAN_ERROR_EXT message. The RX error counter +is really in struct rx_msg::data[2] and the TX error counter is in +struct rx_msg::data[3]. + +Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device") +Link: https://lore.kernel.org/r/20210825215227.4947-2-stefan.maetje@esd.eu +Cc: stable@vger.kernel.org +Signed-off-by: Stefan Mätje +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/usb/esd_usb2.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/can/usb/esd_usb2.c ++++ b/drivers/net/can/usb/esd_usb2.c +@@ -236,8 +236,8 @@ static void esd_usb2_rx_event(struct esd + if (id == ESD_EV_CAN_ERROR_EXT) { + u8 state = msg->msg.rx.data[0]; + u8 ecc = msg->msg.rx.data[1]; +- u8 txerr = msg->msg.rx.data[2]; +- u8 rxerr = msg->msg.rx.data[3]; ++ u8 rxerr = msg->msg.rx.data[2]; ++ u8 txerr = msg->msg.rx.data[3]; + + skb = alloc_can_err_skb(priv->netdev, &cf); + if (skb == NULL) { diff --git a/queue-4.19/revert-usb-serial-ch341-fix-character-loss-at-high-transfer-rates.patch b/queue-4.19/revert-usb-serial-ch341-fix-character-loss-at-high-transfer-rates.patch new file mode 100644 index 00000000000..303755a705e --- /dev/null +++ b/queue-4.19/revert-usb-serial-ch341-fix-character-loss-at-high-transfer-rates.patch @@ -0,0 +1,44 @@ +From df7b16d1c00ecb3da3a30c999cdb39f273c99a2f Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 24 Aug 2021 14:19:26 +0200 +Subject: Revert "USB: serial: ch341: fix character loss at high transfer rates" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Johan Hovold + +commit df7b16d1c00ecb3da3a30c999cdb39f273c99a2f upstream. + +This reverts commit 3c18e9baee0ef97510dcda78c82285f52626764b. + +These devices do not appear to send a zero-length packet when the +transfer size is a multiple of the bulk-endpoint max-packet size. This +means that incoming data may not be processed by the driver until a +short packet is received or the receive buffer is full. + +Revert back to using endpoint-sized receive buffers to avoid stalled +reads. + +Reported-by: Paul Größel +Link: https://bugzilla.kernel.org/show_bug.cgi?id=214131 +Fixes: 3c18e9baee0e ("USB: serial: ch341: fix character loss at high transfer rates") +Cc: stable@vger.kernel.org +Cc: Willy Tarreau +Link: https://lore.kernel.org/r/20210824121926.19311-1-johan@kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/ch341.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -625,7 +625,6 @@ static struct usb_serial_driver ch341_de + .owner = THIS_MODULE, + .name = "ch341-uart", + }, +- .bulk_in_size = 512, + .id_table = id_table, + .num_ports = 1, + .open = ch341_open, diff --git a/queue-4.19/series b/queue-4.19/series index 051f2e9cfaf..a8ed99cf197 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -5,3 +5,8 @@ bpf-fix-truncation-handling-for-mod32-dst-reg-wrt-zero.patch arc-fix-config_stackdepot.patch netfilter-conntrack-collect-all-entries-in-one-cycle.patch once-fix-panic-when-module-unload.patch +can-usb-esd_usb2-esd_usb2_rx_event-fix-the-interchange-of-the-can-rx-and-tx-error-counters.patch +revert-usb-serial-ch341-fix-character-loss-at-high-transfer-rates.patch +usb-serial-option-add-new-vid-pid-to-support-fibocom-fg150.patch +usb-dwc3-gadget-fix-dwc3_calc_trbs_left.patch +usb-dwc3-gadget-stop-ep0-transfers-during-pullup-disable.patch diff --git a/queue-4.19/usb-dwc3-gadget-fix-dwc3_calc_trbs_left.patch b/queue-4.19/usb-dwc3-gadget-fix-dwc3_calc_trbs_left.patch new file mode 100644 index 00000000000..f42c480aaac --- /dev/null +++ b/queue-4.19/usb-dwc3-gadget-fix-dwc3_calc_trbs_left.patch @@ -0,0 +1,60 @@ +From 51f1954ad853d01ba4dc2b35dee14d8490ee05a1 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Thu, 19 Aug 2021 03:17:03 +0200 +Subject: usb: dwc3: gadget: Fix dwc3_calc_trbs_left() + +From: Thinh Nguyen + +commit 51f1954ad853d01ba4dc2b35dee14d8490ee05a1 upstream. + +We can't depend on the TRB's HWO bit to determine if the TRB ring is +"full". A TRB is only available when the driver had processed it, not +when the controller consumed and relinquished the TRB's ownership to the +driver. Otherwise, the driver may overwrite unprocessed TRBs. This can +happen when many transfer events accumulate and the system is slow to +process them and/or when there are too many small requests. + +If a request is in the started_list, that means there is one or more +unprocessed TRBs remained. Check this instead of the TRB's HWO bit +whether the TRB ring is full. + +Fixes: c4233573f6ee ("usb: dwc3: gadget: prepare TRBs on update transfers too") +Cc: +Acked-by: Felipe Balbi +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/e91e975affb0d0d02770686afc3a5b9eb84409f6.1629335416.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/gadget.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -894,19 +894,19 @@ static struct dwc3_trb *dwc3_ep_prev_trb + + static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) + { +- struct dwc3_trb *tmp; + u8 trbs_left; + + /* +- * If enqueue & dequeue are equal than it is either full or empty. +- * +- * One way to know for sure is if the TRB right before us has HWO bit +- * set or not. If it has, then we're definitely full and can't fit any +- * more transfers in our ring. ++ * If the enqueue & dequeue are equal then the TRB ring is either full ++ * or empty. It's considered full when there are DWC3_TRB_NUM-1 of TRBs ++ * pending to be processed by the driver. + */ + if (dep->trb_enqueue == dep->trb_dequeue) { +- tmp = dwc3_ep_prev_trb(dep, dep->trb_enqueue); +- if (tmp->ctrl & DWC3_TRB_CTRL_HWO) ++ /* ++ * If there is any request remained in the started_list at ++ * this point, that means there is no TRB available. ++ */ ++ if (!list_empty(&dep->started_list)) + return 0; + + return DWC3_TRB_NUM - 1; diff --git a/queue-4.19/usb-dwc3-gadget-stop-ep0-transfers-during-pullup-disable.patch b/queue-4.19/usb-dwc3-gadget-stop-ep0-transfers-during-pullup-disable.patch new file mode 100644 index 00000000000..f56c9f04244 --- /dev/null +++ b/queue-4.19/usb-dwc3-gadget-stop-ep0-transfers-during-pullup-disable.patch @@ -0,0 +1,59 @@ +From 4a1e25c0a029b97ea4a3d423a6392bfacc3b2e39 Mon Sep 17 00:00:00 2001 +From: Wesley Cheng +Date: Tue, 24 Aug 2021 21:28:55 -0700 +Subject: usb: dwc3: gadget: Stop EP0 transfers during pullup disable + +From: Wesley Cheng + +commit 4a1e25c0a029b97ea4a3d423a6392bfacc3b2e39 upstream. + +During a USB cable disconnect, or soft disconnect scenario, a pending +SETUP transaction may not be completed, leading to the following +error: + + dwc3 a600000.dwc3: timed out waiting for SETUP phase + +If this occurs, then the entire pullup disable routine is skipped and +proper cleanup and halting of the controller does not complete. + +Instead of returning an error (which is ignored from the UDC +perspective), allow the pullup disable routine to continue, which +will also handle disabling of EP0/1. This will end any active +transfers as well. Ensure to clear any delayed_status also, as the +timeout could happen within the STATUS stage. + +Fixes: bb0147364850 ("usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do so") +Cc: +Reviewed-by: Thinh Nguyen +Acked-by: Felipe Balbi +Signed-off-by: Wesley Cheng +Link: https://lore.kernel.org/r/20210825042855.7977-1-wcheng@codeaurora.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/gadget.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -1805,10 +1805,8 @@ static int dwc3_gadget_pullup(struct usb + + ret = wait_for_completion_timeout(&dwc->ep0_in_setup, + msecs_to_jiffies(DWC3_PULL_UP_TIMEOUT)); +- if (ret == 0) { +- dev_err(dwc->dev, "timed out waiting for SETUP phase\n"); +- return -ETIMEDOUT; +- } ++ if (ret == 0) ++ dev_warn(dwc->dev, "timed out waiting for SETUP phase\n"); + } + + spin_lock_irqsave(&dwc->lock, flags); +@@ -1946,6 +1944,7 @@ static int __dwc3_gadget_start(struct dw + /* begin to receive SETUP packets */ + dwc->ep0state = EP0_SETUP_PHASE; + dwc->link_state = DWC3_LINK_STATE_SS_DIS; ++ dwc->delayed_status = false; + dwc3_ep0_out_start(dwc); + + dwc3_gadget_enable_irq(dwc); diff --git a/queue-4.19/usb-serial-option-add-new-vid-pid-to-support-fibocom-fg150.patch b/queue-4.19/usb-serial-option-add-new-vid-pid-to-support-fibocom-fg150.patch new file mode 100644 index 00000000000..5bbe769ca81 --- /dev/null +++ b/queue-4.19/usb-serial-option-add-new-vid-pid-to-support-fibocom-fg150.patch @@ -0,0 +1,278 @@ +From 2829a4e3cf3a6ac2fa3cdb681b37574630fb9c1a Mon Sep 17 00:00:00 2001 +From: Zhengjun Zhang +Date: Mon, 9 Aug 2021 21:35:53 +0800 +Subject: USB: serial: option: add new VID/PID to support Fibocom FG150 + +From: Zhengjun Zhang + +commit 2829a4e3cf3a6ac2fa3cdb681b37574630fb9c1a upstream. + +Fibocom FG150 is a 5G module based on Qualcomm SDX55 platform, +support Sub-6G band. + +Here are the outputs of lsusb -v and usb-devices: + +> T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0 +> D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 +> P: Vendor=2cb7 ProdID=010b Rev=04.14 +> S: Manufacturer=Fibocom +> S: Product=Fibocom Modem_SN:XXXXXXXX +> S: SerialNumber=XXXXXXXX +> C: #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA +> I: If#=0x0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host +> I: If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host +> I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +> I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none) +> I: If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) + +> Bus 002 Device 002: ID 2cb7:010b Fibocom Fibocom Modem_SN:XXXXXXXX +> Device Descriptor: +> bLength 18 +> bDescriptorType 1 +> bcdUSB 3.20 +> bDeviceClass 0 +> bDeviceSubClass 0 +> bDeviceProtocol 0 +> bMaxPacketSize0 9 +> idVendor 0x2cb7 Fibocom +> idProduct 0x010b +> bcdDevice 4.14 +> iManufacturer 1 Fibocom +> iProduct 2 Fibocom Modem_SN:XXXXXXXX +> iSerial 3 XXXXXXXX +> bNumConfigurations 1 +> Configuration Descriptor: +> bLength 9 +> bDescriptorType 2 +> wTotalLength 0x00e6 +> bNumInterfaces 5 +> bConfigurationValue 1 +> iConfiguration 4 RNDIS_DUN_DIAG_ADB +> bmAttributes 0xa0 +> (Bus Powered) +> Remote Wakeup +> MaxPower 896mA +> Interface Association: +> bLength 8 +> bDescriptorType 11 +> bFirstInterface 0 +> bInterfaceCount 2 +> bFunctionClass 239 Miscellaneous Device +> bFunctionSubClass 4 +> bFunctionProtocol 1 +> iFunction 7 RNDIS +> Interface Descriptor: +> bLength 9 +> bDescriptorType 4 +> bInterfaceNumber 0 +> bAlternateSetting 0 +> bNumEndpoints 1 +> bInterfaceClass 239 Miscellaneous Device +> bInterfaceSubClass 4 +> bInterfaceProtocol 1 +> iInterface 0 +> ** UNRECOGNIZED: 05 24 00 10 01 +> ** UNRECOGNIZED: 05 24 01 00 01 +> ** UNRECOGNIZED: 04 24 02 00 +> ** UNRECOGNIZED: 05 24 06 00 01 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x81 EP 1 IN +> bmAttributes 3 +> Transfer Type Interrupt +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0008 1x 8 bytes +> bInterval 9 +> bMaxBurst 0 +> Interface Descriptor: +> bLength 9 +> bDescriptorType 4 +> bInterfaceNumber 1 +> bAlternateSetting 0 +> bNumEndpoints 2 +> bInterfaceClass 10 CDC Data +> bInterfaceSubClass 0 +> bInterfaceProtocol 0 +> iInterface 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x8e EP 14 IN +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 6 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x0f EP 15 OUT +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 6 +> Interface Descriptor: +> bLength 9 +> bDescriptorType 4 +> bInterfaceNumber 2 +> bAlternateSetting 0 +> bNumEndpoints 3 +> bInterfaceClass 255 Vendor Specific Class +> bInterfaceSubClass 0 +> bInterfaceProtocol 0 +> iInterface 0 +> ** UNRECOGNIZED: 05 24 00 10 01 +> ** UNRECOGNIZED: 05 24 01 00 00 +> ** UNRECOGNIZED: 04 24 02 02 +> ** UNRECOGNIZED: 05 24 06 00 00 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x83 EP 3 IN +> bmAttributes 3 +> Transfer Type Interrupt +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x000a 1x 10 bytes +> bInterval 9 +> bMaxBurst 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x82 EP 2 IN +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x01 EP 1 OUT +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Interface Descriptor: +> bLength 9 +> bDescriptorType 4 +> bInterfaceNumber 3 +> bAlternateSetting 0 +> bNumEndpoints 2 +> bInterfaceClass 255 Vendor Specific Class +> bInterfaceSubClass 255 Vendor Specific Subclass +> bInterfaceProtocol 48 +> iInterface 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x84 EP 4 IN +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x02 EP 2 OUT +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Interface Descriptor: +> bLength 9 +> bDescriptorType 4 +> bInterfaceNumber 4 +> bAlternateSetting 0 +> bNumEndpoints 2 +> bInterfaceClass 255 Vendor Specific Class +> bInterfaceSubClass 66 +> bInterfaceProtocol 1 +> iInterface 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x03 EP 3 OUT +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Endpoint Descriptor: +> bLength 7 +> bDescriptorType 5 +> bEndpointAddress 0x85 EP 5 IN +> bmAttributes 2 +> Transfer Type Bulk +> Synch Type None +> Usage Type Data +> wMaxPacketSize 0x0400 1x 1024 bytes +> bInterval 0 +> bMaxBurst 0 +> Binary Object Store Descriptor: +> bLength 5 +> bDescriptorType 15 +> wTotalLength 0x0016 +> bNumDeviceCaps 2 +> USB 2.0 Extension Device Capability: +> bLength 7 +> bDescriptorType 16 +> bDevCapabilityType 2 +> bmAttributes 0x00000006 +> BESL Link Power Management (LPM) Supported +> SuperSpeed USB Device Capability: +> bLength 10 +> bDescriptorType 16 +> bDevCapabilityType 3 +> bmAttributes 0x00 +> wSpeedsSupported 0x000f +> Device can operate at Low Speed (1Mbps) +> Device can operate at Full Speed (12Mbps) +> Device can operate at High Speed (480Mbps) +> Device can operate at SuperSpeed (5Gbps) +> bFunctionalitySupport 1 +> Lowest fully-functional device speed is Full Speed (12Mbps) +> bU1DevExitLat 1 micro seconds +> bU2DevExitLat 500 micro seconds +> Device Status: 0x0000 +> (Bus Powered) + +Signed-off-by: Zhengjun Zhang +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -2074,6 +2074,8 @@ static const struct usb_device_id option + .driver_info = RSVD(4) | RSVD(5) }, + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ + .driver_info = RSVD(6) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0xff, 0x30) }, /* Fibocom FG150 Diag */ ++ { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0, 0) }, /* Fibocom FG150 AT */ + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ + { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ + { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */