* [PATCH 1/4] can: ems_usb: cancel urb on -EPIPE and -EPROTO
2017-12-05 19:15 [PATCH 0/4] URB disconnect bug fixes Martin Kelly
@ 2017-12-05 19:15 ` Martin Kelly
2017-12-05 19:15 ` [PATCH 2/4] can: esd_usb2: " Martin Kelly
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Martin Kelly @ 2017-12-05 19:15 UTC (permalink / raw)
To: linux-can
Cc: Marc Kleine-Budde, Wolfgang Grandegger, Stefan Mätje,
Jimmy Assarsson, Martin Kelly
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 <mkelly@xevo.com>
---
drivers/net/can/usb/ems_usb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index b3d02759c226..b00358297424 100644
--- 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_callback(struct urb *urb)
case -ECONNRESET: /* unlink */
case -ENOENT:
+ case -EPIPE:
+ case -EPROTO:
case -ESHUTDOWN:
return;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/4] can: esd_usb2: cancel urb on -EPIPE and -EPROTO
2017-12-05 19:15 [PATCH 0/4] URB disconnect bug fixes Martin Kelly
2017-12-05 19:15 ` [PATCH 1/4] can: ems_usb: cancel urb on -EPIPE and -EPROTO Martin Kelly
@ 2017-12-05 19:15 ` Martin Kelly
2017-12-05 19:15 ` [PATCH 3/4] can: kvaser_usb: " Martin Kelly
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Martin Kelly @ 2017-12-05 19:15 UTC (permalink / raw)
To: linux-can
Cc: Marc Kleine-Budde, Wolfgang Grandegger, Stefan Mätje,
Jimmy Assarsson, Martin Kelly
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 <mkelly@xevo.com>
---
drivers/net/can/usb/esd_usb2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 9fdb0f0bfa06..c6dcf93675c0 100644
--- 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(struct urb *urb)
break;
case -ENOENT:
+ case -EPIPE:
+ case -EPROTO:
case -ESHUTDOWN:
return;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/4] can: kvaser_usb: cancel urb on -EPIPE and -EPROTO
2017-12-05 19:15 [PATCH 0/4] URB disconnect bug fixes Martin Kelly
2017-12-05 19:15 ` [PATCH 1/4] can: ems_usb: cancel urb on -EPIPE and -EPROTO Martin Kelly
2017-12-05 19:15 ` [PATCH 2/4] can: esd_usb2: " Martin Kelly
@ 2017-12-05 19:15 ` Martin Kelly
2017-12-05 19:15 ` [PATCH 4/4] can: usb_8dev: " Martin Kelly
2017-12-06 9:20 ` [PATCH 0/4] URB disconnect bug fixes Marc Kleine-Budde
4 siblings, 0 replies; 6+ messages in thread
From: Martin Kelly @ 2017-12-05 19:15 UTC (permalink / raw)
To: linux-can
Cc: Marc Kleine-Budde, Wolfgang Grandegger, Stefan Mätje,
Jimmy Assarsson, Martin Kelly
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 <mkelly@xevo.com>
---
drivers/net/can/usb/kvaser_usb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index f95945915d20..63587b8e6825 100644
--- 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_callback(struct urb *urb)
case 0:
break;
case -ENOENT:
+ case -EPIPE:
+ case -EPROTO:
case -ESHUTDOWN:
return;
default:
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] can: usb_8dev: cancel urb on -EPIPE and -EPROTO
2017-12-05 19:15 [PATCH 0/4] URB disconnect bug fixes Martin Kelly
` (2 preceding siblings ...)
2017-12-05 19:15 ` [PATCH 3/4] can: kvaser_usb: " Martin Kelly
@ 2017-12-05 19:15 ` Martin Kelly
2017-12-06 9:20 ` [PATCH 0/4] URB disconnect bug fixes Marc Kleine-Budde
4 siblings, 0 replies; 6+ messages in thread
From: Martin Kelly @ 2017-12-05 19:15 UTC (permalink / raw)
To: linux-can
Cc: Marc Kleine-Budde, Wolfgang Grandegger, Stefan Mätje,
Jimmy Assarsson, Martin Kelly
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 <mkelly@xevo.com>
---
drivers/net/can/usb/usb_8dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index d000cb62d6ae..27861c417c94 100644
--- 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(struct urb *urb)
break;
case -ENOENT:
+ case -EPIPE:
+ case -EPROTO:
case -ESHUTDOWN:
return;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/4] URB disconnect bug fixes
2017-12-05 19:15 [PATCH 0/4] URB disconnect bug fixes Martin Kelly
` (3 preceding siblings ...)
2017-12-05 19:15 ` [PATCH 4/4] can: usb_8dev: " Martin Kelly
@ 2017-12-06 9:20 ` Marc Kleine-Budde
4 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2017-12-06 9:20 UTC (permalink / raw)
To: Martin Kelly, linux-can
Cc: Wolfgang Grandegger, Stefan Mätje, Jimmy Assarsson
[-- Attachment #1.1: Type: text/plain, Size: 1166 bytes --]
On 12/05/2017 08:15 PM, Martin Kelly wrote:
> This patch series is to fix a common bug I found in mcba_usb that appears to
> also exist in these drivers. Because I don't own the hardware, I cannot test the
> changes, but I wanted to send the change so that others could do so.
>
> The bug is that, when you disconnect the device, you get -EPIPE and -EPROTO
> error codes (exactly which depends on the timing and the system) in the URB read
> callback. The driver then resubmits the URB, which immediately fails because the
> device is unplugged. On a slower system like a Raspberry Pi, this can cause a
> kernel stall, while on a desktop, the disconnect code runs fast enough to
> prevent a stall and it's easy not to notice the issue.
>
> Fix this by not resubmitting an URB that receives an -EPIPE/-EPROTO code.
Applied this series and the mcba patch.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread