diff mbox series

can: ucan: fix non-atomic allocation in completion handler

Message ID 20191128182603.22004-1-johan@kernel.org
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series can: ucan: fix non-atomic allocation in completion handler | expand

Commit Message

Johan Hovold Nov. 28, 2019, 6:26 p.m. UTC
USB completion handlers are called in atomic context and must
specifically not allocate memory using GFP_KERNEL.

Fixes: 9f2d3eae88d2 ("can: ucan: add driver for Theobroma Systems UCAN devices")
Cc: stable <stable@vger.kernel.org>     # 4.19
Cc: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
Cc: Martin Elshuber <martin.elshuber@theobroma-systems.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/can/usb/ucan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc Kleine-Budde Dec. 3, 2019, 10:07 a.m. UTC | #1
On 11/28/19 7:26 PM, Johan Hovold wrote:
> USB completion handlers are called in atomic context and must
> specifically not allocate memory using GFP_KERNEL.
> 
> Fixes: 9f2d3eae88d2 ("can: ucan: add driver for Theobroma Systems UCAN devices")
> Cc: stable <stable@vger.kernel.org>     # 4.19
> Cc: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
> Cc: Martin Elshuber <martin.elshuber@theobroma-systems.com>
> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Added to linux-can.

tnx,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index 04aac3bb54ef..81e942f713e6 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -792,7 +792,7 @@  static void ucan_read_bulk_callback(struct urb *urb)
 			  up);
 
 	usb_anchor_urb(urb, &up->rx_urbs);
-	ret = usb_submit_urb(urb, GFP_KERNEL);
+	ret = usb_submit_urb(urb, GFP_ATOMIC);
 
 	if (ret < 0) {
 		netdev_err(up->netdev,