]>
Commit | Line | Data |
---|---|---|
ad834691 GKH |
1 | From 3b7c7e52efda0d4640060de747768360ba70a7c0 Mon Sep 17 00:00:00 2001 |
2 | From: Alexey Khoroshilov <khoroshilov@ispras.ru> | |
3 | Date: Fri, 12 Aug 2016 01:05:09 +0300 | |
4 | Subject: USB: serial: mos7840: fix non-atomic allocation in write path | |
5 | ||
6 | From: Alexey Khoroshilov <khoroshilov@ispras.ru> | |
7 | ||
8 | commit 3b7c7e52efda0d4640060de747768360ba70a7c0 upstream. | |
9 | ||
10 | There is an allocation with GFP_KERNEL flag in mos7840_write(), | |
11 | while it may be called from interrupt context. | |
12 | ||
13 | Follow-up for commit 191252837626 ("USB: kobil_sct: fix non-atomic | |
14 | allocation in write path") | |
15 | ||
16 | Found by Linux Driver Verification project (linuxtesting.org). | |
17 | ||
18 | Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> | |
19 | Signed-off-by: Johan Hovold <johan@kernel.org> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | ||
22 | --- | |
23 | drivers/usb/serial/mos7840.c | 4 ++-- | |
24 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
25 | ||
26 | --- a/drivers/usb/serial/mos7840.c | |
27 | +++ b/drivers/usb/serial/mos7840.c | |
28 | @@ -1340,8 +1340,8 @@ static int mos7840_write(struct tty_stru | |
29 | } | |
30 | ||
31 | if (urb->transfer_buffer == NULL) { | |
32 | - urb->transfer_buffer = | |
33 | - kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); | |
34 | + urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, | |
35 | + GFP_ATOMIC); | |
36 | if (!urb->transfer_buffer) | |
37 | goto exit; | |
38 | } |