Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] can: ucan: fix non-atomic allocation in completion handler
@ 2019-11-28 18:26 Johan Hovold
  2019-12-03 10:07 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2019-11-28 18:26 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde
  Cc: linux-can, netdev, linux-kernel, Johan Hovold, stable,
	Jakob Unterwurzacher, Martin Elshuber, Philipp Tomsich

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(-)

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,
-- 
2.24.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: ucan: fix non-atomic allocation in completion handler
  2019-11-28 18:26 [PATCH] can: ucan: fix non-atomic allocation in completion handler Johan Hovold
@ 2019-12-03 10:07 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2019-12-03 10:07 UTC (permalink / raw)
  To: Johan Hovold, Wolfgang Grandegger
  Cc: linux-can, netdev, linux-kernel, stable, Jakob Unterwurzacher,
	Martin Elshuber, Philipp Tomsich

[-- Attachment #1.1: Type: text/plain, Size: 858 bytes --]

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

-- 
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 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 18:26 [PATCH] can: ucan: fix non-atomic allocation in completion handler Johan Hovold
2019-12-03 10:07 ` Marc Kleine-Budde

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git