From: Greg Kroah-Hartman Date: Thu, 9 May 2019 09:01:48 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.9.175~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c14fc923029538b0f1339998561549753fbbcfe;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: usb-dwc3-fix-default-lpm_nyet_threshold-value.patch usb-serial-f81232-fix-interrupt-worker-not-stop.patch usb-storage-set-virt_boundary_mask-to-avoid-sg-overflows.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index 32850f141ce..7fb71b754b6 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -17,3 +17,6 @@ iommu-amd-set-exclusion-range-correctly.patch mm-add-try_get_page-helper-function.patch arm-8680-1-boot-compressed-fix-inappropriate-thumb2-.patch genirq-prevent-use-after-free-and-work-list-corrupti.patch +usb-dwc3-fix-default-lpm_nyet_threshold-value.patch +usb-serial-f81232-fix-interrupt-worker-not-stop.patch +usb-storage-set-virt_boundary_mask-to-avoid-sg-overflows.patch diff --git a/queue-4.9/usb-dwc3-fix-default-lpm_nyet_threshold-value.patch b/queue-4.9/usb-dwc3-fix-default-lpm_nyet_threshold-value.patch new file mode 100644 index 00000000000..96f7f43e009 --- /dev/null +++ b/queue-4.9/usb-dwc3-fix-default-lpm_nyet_threshold-value.patch @@ -0,0 +1,33 @@ +From 8d791929b2fbdf7734c1596d808e55cb457f4562 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Thu, 25 Apr 2019 13:55:23 -0700 +Subject: usb: dwc3: Fix default lpm_nyet_threshold value + +From: Thinh Nguyen + +commit 8d791929b2fbdf7734c1596d808e55cb457f4562 upstream. + +The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change +the default value to 15. + +Cc: stable@vger.kernel.org +Fixes: 80caf7d21adc ("usb: dwc3: add lpm erratum support") +Signed-off-by: Thinh Nguyen +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/dwc3/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -991,7 +991,7 @@ static int dwc3_probe(struct platform_de + dwc->regs_size = resource_size(res); + + /* default to highest possible threshold */ +- lpm_nyet_threshold = 0xff; ++ lpm_nyet_threshold = 0xf; + + /* default to -3.5dB de-emphasis */ + tx_de_emphasis = 1; diff --git a/queue-4.9/usb-serial-f81232-fix-interrupt-worker-not-stop.patch b/queue-4.9/usb-serial-f81232-fix-interrupt-worker-not-stop.patch new file mode 100644 index 00000000000..eedb31a3dd6 --- /dev/null +++ b/queue-4.9/usb-serial-f81232-fix-interrupt-worker-not-stop.patch @@ -0,0 +1,92 @@ +From 804dbee1e49774918339c1e5a87400988c0819e8 Mon Sep 17 00:00:00 2001 +From: "Ji-Ze Hong (Peter Hong)" +Date: Tue, 30 Apr 2019 09:22:29 +0800 +Subject: USB: serial: f81232: fix interrupt worker not stop + +From: Ji-Ze Hong (Peter Hong) + +commit 804dbee1e49774918339c1e5a87400988c0819e8 upstream. + +The F81232 will use interrupt worker to handle MSR change. +This patch will fix the issue that interrupt work should stop +in close() and suspend(). + +This also fixes line-status events being disabled after a suspend cycle +until the port is re-opened. + +Signed-off-by: Ji-Ze Hong (Peter Hong) +[ johan: amend commit message ] +Fixes: 87fe5adcd8de ("USB: f81232: implement read IIR/MSR with endpoint") +Cc: stable # 4.1 +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/f81232.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +--- a/drivers/usb/serial/f81232.c ++++ b/drivers/usb/serial/f81232.c +@@ -560,9 +560,12 @@ static int f81232_open(struct tty_struct + + static void f81232_close(struct usb_serial_port *port) + { ++ struct f81232_private *port_priv = usb_get_serial_port_data(port); ++ + f81232_port_disable(port); + usb_serial_generic_close(port); + usb_kill_urb(port->interrupt_in_urb); ++ flush_work(&port_priv->interrupt_work); + } + + static void f81232_dtr_rts(struct usb_serial_port *port, int on) +@@ -656,6 +659,40 @@ static int f81232_port_remove(struct usb + return 0; + } + ++static int f81232_suspend(struct usb_serial *serial, pm_message_t message) ++{ ++ struct usb_serial_port *port = serial->port[0]; ++ struct f81232_private *port_priv = usb_get_serial_port_data(port); ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) ++ usb_kill_urb(port->read_urbs[i]); ++ ++ usb_kill_urb(port->interrupt_in_urb); ++ ++ if (port_priv) ++ flush_work(&port_priv->interrupt_work); ++ ++ return 0; ++} ++ ++static int f81232_resume(struct usb_serial *serial) ++{ ++ struct usb_serial_port *port = serial->port[0]; ++ int result; ++ ++ if (tty_port_initialized(&port->port)) { ++ result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); ++ if (result) { ++ dev_err(&port->dev, "submit interrupt urb failed: %d\n", ++ result); ++ return result; ++ } ++ } ++ ++ return usb_serial_generic_resume(serial); ++} ++ + static struct usb_serial_driver f81232_device = { + .driver = { + .owner = THIS_MODULE, +@@ -679,6 +716,8 @@ static struct usb_serial_driver f81232_d + .read_int_callback = f81232_read_int_callback, + .port_probe = f81232_port_probe, + .port_remove = f81232_port_remove, ++ .suspend = f81232_suspend, ++ .resume = f81232_resume, + }; + + static struct usb_serial_driver * const serial_drivers[] = { diff --git a/queue-4.9/usb-storage-set-virt_boundary_mask-to-avoid-sg-overflows.patch b/queue-4.9/usb-storage-set-virt_boundary_mask-to-avoid-sg-overflows.patch new file mode 100644 index 00000000000..421d829be3e --- /dev/null +++ b/queue-4.9/usb-storage-set-virt_boundary_mask-to-avoid-sg-overflows.patch @@ -0,0 +1,87 @@ +From 747668dbc061b3e62bc1982767a3a1f9815fcf0e Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Mon, 15 Apr 2019 13:19:25 -0400 +Subject: usb-storage: Set virt_boundary_mask to avoid SG overflows + +From: Alan Stern + +commit 747668dbc061b3e62bc1982767a3a1f9815fcf0e upstream. + +The USB subsystem has always had an unusual requirement for its +scatter-gather transfers: Each element in the scatterlist (except the +last one) must have a length divisible by the bulk maxpacket size. +This is a particular issue for USB mass storage, which uses SG lists +created by the block layer rather than setting up its own. + +So far we have scraped by okay because most devices have a logical +block size of 512 bytes or larger, and the bulk maxpacket sizes for +USB 2 and below are all <= 512. However, USB 3 has a bulk maxpacket +size of 1024. Since the xhci-hcd driver includes native SG support, +this hasn't mattered much. But now people are trying to use USB-3 +mass storage devices with USBIP, and the vhci-hcd driver currently +does not have full SG support. + +The result is an overflow error, when the driver attempts to implement +an SG transfer of 63 512-byte blocks as a single +3584-byte (7 blocks) transfer followed by seven 4096-byte (8 blocks) +transfers. The device instead sends 31 1024-byte packets followed by +a 512-byte packet, and this overruns the first SG buffer. + +Ideally this would be fixed by adding better SG support to vhci-hcd. +But for now it appears we can work around the problem by +asking the block layer to respect the maxpacket limitation, through +the use of the virt_boundary_mask. + +Signed-off-by: Alan Stern +Reported-by: Seth Bollinger +Tested-by: Seth Bollinger +CC: Ming Lei +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/scsiglue.c | 26 ++++++++++++-------------- + 1 file changed, 12 insertions(+), 14 deletions(-) + +--- a/drivers/usb/storage/scsiglue.c ++++ b/drivers/usb/storage/scsiglue.c +@@ -81,6 +81,7 @@ static const char* host_info(struct Scsi + static int slave_alloc (struct scsi_device *sdev) + { + struct us_data *us = host_to_us(sdev->host); ++ int maxp; + + /* + * Set the INQUIRY transfer length to 36. We don't use any of +@@ -90,20 +91,17 @@ static int slave_alloc (struct scsi_devi + sdev->inquiry_len = 36; + + /* +- * USB has unusual DMA-alignment requirements: Although the +- * starting address of each scatter-gather element doesn't matter, +- * the length of each element except the last must be divisible +- * by the Bulk maxpacket value. There's currently no way to +- * express this by block-layer constraints, so we'll cop out +- * and simply require addresses to be aligned at 512-byte +- * boundaries. This is okay since most block I/O involves +- * hardware sectors that are multiples of 512 bytes in length, +- * and since host controllers up through USB 2.0 have maxpacket +- * values no larger than 512. +- * +- * But it doesn't suffice for Wireless USB, where Bulk maxpacket +- * values can be as large as 2048. To make that work properly +- * will require changes to the block layer. ++ * USB has unusual scatter-gather requirements: the length of each ++ * scatterlist element except the last must be divisible by the ++ * Bulk maxpacket value. Fortunately this value is always a ++ * power of 2. Inform the block layer about this requirement. ++ */ ++ maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0); ++ blk_queue_virt_boundary(sdev->request_queue, maxp - 1); ++ ++ /* ++ * Some host controllers may have alignment requirements. ++ * We'll play it safe by requiring 512-byte alignment always. + */ + blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); +