]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.3/usb-serial-mos7720-fix-non-atomic-allocation-in-write-path.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / usb-serial-mos7720-fix-non-atomic-allocation-in-write-path.patch
1 From 5a5a1d614287a647b36dff3f40c2b0ceabbc83ec Mon Sep 17 00:00:00 2001
2 From: Alexey Khoroshilov <khoroshilov@ispras.ru>
3 Date: Fri, 12 Aug 2016 01:05:08 +0300
4 Subject: USB: serial: mos7720: fix non-atomic allocation in write path
5
6 From: Alexey Khoroshilov <khoroshilov@ispras.ru>
7
8 commit 5a5a1d614287a647b36dff3f40c2b0ceabbc83ec upstream.
9
10 There is an allocation with GFP_KERNEL flag in mos7720_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/mos7720.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
26 --- a/drivers/usb/serial/mos7720.c
27 +++ b/drivers/usb/serial/mos7720.c
28 @@ -1252,7 +1252,7 @@ static int mos7720_write(struct tty_stru
29
30 if (urb->transfer_buffer == NULL) {
31 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
32 - GFP_KERNEL);
33 + GFP_ATOMIC);
34 if (!urb->transfer_buffer)
35 goto exit;
36 }