From: Greg Kroah-Hartman Date: Sun, 10 Dec 2017 17:08:02 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.9.69~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2593123db73fdbcdfaf8e068de68bc58d9f5904b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: can-ems_usb-cancel-urb-on-epipe-and-eproto.patch can-esd_usb2-cancel-urb-on-epipe-and-eproto.patch can-kvaser_usb-cancel-urb-on-epipe-and-eproto.patch can-kvaser_usb-fix-comparison-bug-in-kvaser_usb_read_bulk_callback.patch can-kvaser_usb-free-buf-in-error-paths.patch can-kvaser_usb-ratelimit-errors-if-incomplete-messages-are-received.patch can-ti_hecc-fix-napi-poll-return-value-for-repoll.patch can-usb_8dev-cancel-urb-on-epipe-and-eproto.patch usb-gadget-udc-renesas_usb3-fix-number-of-the-pipes.patch --- diff --git a/queue-4.9/can-ems_usb-cancel-urb-on-epipe-and-eproto.patch b/queue-4.9/can-ems_usb-cancel-urb-on-epipe-and-eproto.patch new file mode 100644 index 00000000000..dbd6e407656 --- /dev/null +++ b/queue-4.9/can-ems_usb-cancel-urb-on-epipe-and-eproto.patch @@ -0,0 +1,36 @@ +From bd352e1adfe0d02d3ea7c8e3fb19183dc317e679 Mon Sep 17 00:00:00 2001 +From: Martin Kelly +Date: Tue, 5 Dec 2017 11:15:47 -0800 +Subject: can: ems_usb: cancel urb on -EPIPE and -EPROTO + +From: Martin Kelly + +commit bd352e1adfe0d02d3ea7c8e3fb19183dc317e679 upstream. + +In mcba_usb, we have observed that when you unplug the device, the driver will +endlessly resubmit failing URBs, which can cause CPU stalls. This issue +is fixed in mcba_usb by catching the codes seen on device disconnect +(-EPIPE and -EPROTO). + +This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it +in the same way. + +Signed-off-by: Martin Kelly +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/ems_usb.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/can/usb/ems_usb.c ++++ b/drivers/net/can/usb/ems_usb.c +@@ -288,6 +288,8 @@ static void ems_usb_read_interrupt_callb + + case -ECONNRESET: /* unlink */ + case -ENOENT: ++ case -EPIPE: ++ case -EPROTO: + case -ESHUTDOWN: + return; + diff --git a/queue-4.9/can-esd_usb2-cancel-urb-on-epipe-and-eproto.patch b/queue-4.9/can-esd_usb2-cancel-urb-on-epipe-and-eproto.patch new file mode 100644 index 00000000000..6ebab9606e2 --- /dev/null +++ b/queue-4.9/can-esd_usb2-cancel-urb-on-epipe-and-eproto.patch @@ -0,0 +1,36 @@ +From 7a31ced3de06e9878e4f9c3abe8f87d9344d8144 Mon Sep 17 00:00:00 2001 +From: Martin Kelly +Date: Tue, 5 Dec 2017 11:15:48 -0800 +Subject: can: esd_usb2: cancel urb on -EPIPE and -EPROTO + +From: Martin Kelly + +commit 7a31ced3de06e9878e4f9c3abe8f87d9344d8144 upstream. + +In mcba_usb, we have observed that when you unplug the device, the driver will +endlessly resubmit failing URBs, which can cause CPU stalls. This issue +is fixed in mcba_usb by catching the codes seen on device disconnect +(-EPIPE and -EPROTO). + +This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it +in the same way. + +Signed-off-by: Martin Kelly +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/esd_usb2.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/can/usb/esd_usb2.c ++++ b/drivers/net/can/usb/esd_usb2.c +@@ -393,6 +393,8 @@ static void esd_usb2_read_bulk_callback( + break; + + case -ENOENT: ++ case -EPIPE: ++ case -EPROTO: + case -ESHUTDOWN: + return; + diff --git a/queue-4.9/can-kvaser_usb-cancel-urb-on-epipe-and-eproto.patch b/queue-4.9/can-kvaser_usb-cancel-urb-on-epipe-and-eproto.patch new file mode 100644 index 00000000000..37019c419f9 --- /dev/null +++ b/queue-4.9/can-kvaser_usb-cancel-urb-on-epipe-and-eproto.patch @@ -0,0 +1,36 @@ +From 6aa8d5945502baf4687d80de59b7ac865e9e666b Mon Sep 17 00:00:00 2001 +From: Martin Kelly +Date: Tue, 5 Dec 2017 11:15:49 -0800 +Subject: can: kvaser_usb: cancel urb on -EPIPE and -EPROTO + +From: Martin Kelly + +commit 6aa8d5945502baf4687d80de59b7ac865e9e666b upstream. + +In mcba_usb, we have observed that when you unplug the device, the driver will +endlessly resubmit failing URBs, which can cause CPU stalls. This issue +is fixed in mcba_usb by catching the codes seen on device disconnect +(-EPIPE and -EPROTO). + +This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it +in the same way. + +Signed-off-by: Martin Kelly +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/kvaser_usb.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/can/usb/kvaser_usb.c ++++ b/drivers/net/can/usb/kvaser_usb.c +@@ -1326,6 +1326,8 @@ static void kvaser_usb_read_bulk_callbac + case 0: + break; + case -ENOENT: ++ case -EPIPE: ++ case -EPROTO: + case -ESHUTDOWN: + return; + default: diff --git a/queue-4.9/can-kvaser_usb-fix-comparison-bug-in-kvaser_usb_read_bulk_callback.patch b/queue-4.9/can-kvaser_usb-fix-comparison-bug-in-kvaser_usb_read_bulk_callback.patch new file mode 100644 index 00000000000..c9a8cd0d054 --- /dev/null +++ b/queue-4.9/can-kvaser_usb-fix-comparison-bug-in-kvaser_usb_read_bulk_callback.patch @@ -0,0 +1,38 @@ +From e84f44eb5523401faeb9cc1c97895b68e3cfb78d Mon Sep 17 00:00:00 2001 +From: Jimmy Assarsson +Date: Tue, 21 Nov 2017 08:22:27 +0100 +Subject: can: kvaser_usb: Fix comparison bug in kvaser_usb_read_bulk_callback() + +From: Jimmy Assarsson + +commit e84f44eb5523401faeb9cc1c97895b68e3cfb78d upstream. + +The conditon in the while-loop becomes true when actual_length is less than +2 (MSG_HEADER_LEN). In best case we end up with a former, already +dispatched msg, that got msg->len greater than actual_length. This will +result in a "Format error" error printout. + +Problem seen when unplugging a Kvaser USB device connected to a vbox guest. + +warning: comparison between signed and unsigned integer expressions +[-Wsign-compare] + +Signed-off-by: Jimmy Assarsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/kvaser_usb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/can/usb/kvaser_usb.c ++++ b/drivers/net/can/usb/kvaser_usb.c +@@ -1334,7 +1334,7 @@ static void kvaser_usb_read_bulk_callbac + goto resubmit_urb; + } + +- while (pos <= urb->actual_length - MSG_HEADER_LEN) { ++ while (pos <= (int)(urb->actual_length - MSG_HEADER_LEN)) { + msg = urb->transfer_buffer + pos; + + /* The Kvaser firmware can only read and write messages that diff --git a/queue-4.9/can-kvaser_usb-free-buf-in-error-paths.patch b/queue-4.9/can-kvaser_usb-free-buf-in-error-paths.patch new file mode 100644 index 00000000000..c6b5c75669c --- /dev/null +++ b/queue-4.9/can-kvaser_usb-free-buf-in-error-paths.patch @@ -0,0 +1,37 @@ +From 435019b48033138581a6171093b181fc6b4d3d30 Mon Sep 17 00:00:00 2001 +From: Jimmy Assarsson +Date: Tue, 21 Nov 2017 08:22:26 +0100 +Subject: can: kvaser_usb: free buf in error paths + +From: Jimmy Assarsson + +commit 435019b48033138581a6171093b181fc6b4d3d30 upstream. + +The allocated buffer was not freed if usb_submit_urb() failed. + +Signed-off-by: Jimmy Assarsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/kvaser_usb.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/can/usb/kvaser_usb.c ++++ b/drivers/net/can/usb/kvaser_usb.c +@@ -813,6 +813,7 @@ static int kvaser_usb_simple_msg_async(s + if (err) { + netdev_err(netdev, "Error transmitting URB\n"); + usb_unanchor_urb(urb); ++ kfree(buf); + usb_free_urb(urb); + return err; + } +@@ -1768,6 +1769,7 @@ static netdev_tx_t kvaser_usb_start_xmit + spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); + + usb_unanchor_urb(urb); ++ kfree(buf); + + stats->tx_dropped++; + diff --git a/queue-4.9/can-kvaser_usb-ratelimit-errors-if-incomplete-messages-are-received.patch b/queue-4.9/can-kvaser_usb-ratelimit-errors-if-incomplete-messages-are-received.patch new file mode 100644 index 00000000000..1c82c34b2fe --- /dev/null +++ b/queue-4.9/can-kvaser_usb-ratelimit-errors-if-incomplete-messages-are-received.patch @@ -0,0 +1,43 @@ +From 8bd13bd522ff7dfa0eb371921aeb417155f7a3be Mon Sep 17 00:00:00 2001 +From: Jimmy Assarsson +Date: Tue, 21 Nov 2017 08:22:28 +0100 +Subject: can: kvaser_usb: ratelimit errors if incomplete messages are received + +From: Jimmy Assarsson + +commit 8bd13bd522ff7dfa0eb371921aeb417155f7a3be upstream. + +Avoid flooding the kernel log with "Formate error", if incomplete message +are received. + +Signed-off-by: Jimmy Assarsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/kvaser_usb.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/can/usb/kvaser_usb.c ++++ b/drivers/net/can/usb/kvaser_usb.c +@@ -609,8 +609,8 @@ static int kvaser_usb_wait_msg(const str + } + + if (pos + tmp->len > actual_len) { +- dev_err(dev->udev->dev.parent, +- "Format error\n"); ++ dev_err_ratelimited(dev->udev->dev.parent, ++ "Format error\n"); + break; + } + +@@ -1353,7 +1353,8 @@ static void kvaser_usb_read_bulk_callbac + } + + if (pos + msg->len > urb->actual_length) { +- dev_err(dev->udev->dev.parent, "Format error\n"); ++ dev_err_ratelimited(dev->udev->dev.parent, ++ "Format error\n"); + break; + } + diff --git a/queue-4.9/can-ti_hecc-fix-napi-poll-return-value-for-repoll.patch b/queue-4.9/can-ti_hecc-fix-napi-poll-return-value-for-repoll.patch new file mode 100644 index 00000000000..234940ed30e --- /dev/null +++ b/queue-4.9/can-ti_hecc-fix-napi-poll-return-value-for-repoll.patch @@ -0,0 +1,36 @@ +From f6c23b174c3c96616514827407769cbcfc8005cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Oliver=20St=C3=A4bler?= +Date: Mon, 20 Nov 2017 14:45:15 +0100 +Subject: can: ti_hecc: Fix napi poll return value for repoll +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Oliver Stäbler + +commit f6c23b174c3c96616514827407769cbcfc8005cf upstream. + +After commit d75b1ade567f ("net: less interrupt masking in NAPI") napi +repoll is done only when work_done == budget. +So we need to return budget if there are still packets to receive. + +Signed-off-by: Oliver Stäbler +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/ti_hecc.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/can/ti_hecc.c ++++ b/drivers/net/can/ti_hecc.c +@@ -652,6 +652,9 @@ static int ti_hecc_rx_poll(struct napi_s + mbx_mask = hecc_read(priv, HECC_CANMIM); + mbx_mask |= HECC_TX_MBOX_MASK; + hecc_write(priv, HECC_CANMIM, mbx_mask); ++ } else { ++ /* repoll is done only if whole budget is used */ ++ num_pkts = quota; + } + + return num_pkts; diff --git a/queue-4.9/can-usb_8dev-cancel-urb-on-epipe-and-eproto.patch b/queue-4.9/can-usb_8dev-cancel-urb-on-epipe-and-eproto.patch new file mode 100644 index 00000000000..732592dcfdc --- /dev/null +++ b/queue-4.9/can-usb_8dev-cancel-urb-on-epipe-and-eproto.patch @@ -0,0 +1,36 @@ +From 12147edc434c9e4c7c2f5fee2e5519b2e5ac34ce Mon Sep 17 00:00:00 2001 +From: Martin Kelly +Date: Tue, 5 Dec 2017 11:15:50 -0800 +Subject: can: usb_8dev: cancel urb on -EPIPE and -EPROTO + +From: Martin Kelly + +commit 12147edc434c9e4c7c2f5fee2e5519b2e5ac34ce upstream. + +In mcba_usb, we have observed that when you unplug the device, the driver will +endlessly resubmit failing URBs, which can cause CPU stalls. This issue +is fixed in mcba_usb by catching the codes seen on device disconnect +(-EPIPE and -EPROTO). + +This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it +in the same way. + +Signed-off-by: Martin Kelly +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/usb/usb_8dev.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/can/usb/usb_8dev.c ++++ b/drivers/net/can/usb/usb_8dev.c +@@ -524,6 +524,8 @@ static void usb_8dev_read_bulk_callback( + break; + + case -ENOENT: ++ case -EPIPE: ++ case -EPROTO: + case -ESHUTDOWN: + return; + diff --git a/queue-4.9/usb-gadget-udc-renesas_usb3-fix-number-of-the-pipes.patch b/queue-4.9/usb-gadget-udc-renesas_usb3-fix-number-of-the-pipes.patch new file mode 100644 index 00000000000..74b5668f529 --- /dev/null +++ b/queue-4.9/usb-gadget-udc-renesas_usb3-fix-number-of-the-pipes.patch @@ -0,0 +1,35 @@ +From a58204ab91ad8cae4d8474aa0ba5d1fc504860c9 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Mon, 13 Nov 2017 17:59:18 +0900 +Subject: usb: gadget: udc: renesas_usb3: fix number of the pipes + +From: Yoshihiro Shimoda + +commit a58204ab91ad8cae4d8474aa0ba5d1fc504860c9 upstream. + +This controller on R-Car Gen3 has 6 pipes that included PIPE 0 for +control actually. But, the datasheet has error in writing as it has +31 pipes. (However, the previous code defined 30 pipes wrongly...) + +Anyway, this patch fixes it. + +Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller") +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/udc/renesas_usb3.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/udc/renesas_usb3.c ++++ b/drivers/usb/gadget/udc/renesas_usb3.c +@@ -222,7 +222,7 @@ + #define USB3_EP0_SS_MAX_PACKET_SIZE 512 + #define USB3_EP0_HSFS_MAX_PACKET_SIZE 64 + #define USB3_EP0_BUF_SIZE 8 +-#define USB3_MAX_NUM_PIPES 30 ++#define USB3_MAX_NUM_PIPES 6 /* This includes PIPE 0 */ + #define USB3_WAIT_US 3 + + struct renesas_usb3;