Skip to contentSkip to conversation

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

PATCH In review Johan Hovold 2 participants 2 messages Nov 28, 2019 – Dec 3, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: ucan: fix non-atomic allocation in completion handler

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 <[email protected]> # 4.19
Cc Jakob Unterwurzacher <[email protected]>
Cc Martin Elshuber <[email protected]>
Cc Philipp Tomsich <[email protected]>
---
 drivers/net/can/usb/ucan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/ucan.c +1 -1
index 04aac3bb54ef..81e942f713e6 100644
@@ -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,
Signature · 1 line
2.24.0
#1 lore raw
Quoted 9 lines · Johan Hovold

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 <[email protected]> # 4.19
Cc Jakob Unterwurzacher <[email protected]>
Cc Martin Elshuber <[email protected]>
Cc Philipp Tomsich <[email protected]>

Added to linux-can.

tnx,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |