]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.7.3/usb-serial-mos7840-fix-non-atomic-allocation-in-write-path.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / usb-serial-mos7840-fix-non-atomic-allocation-in-write-path.patch
CommitLineData
ad834691
GKH
1From 3b7c7e52efda0d4640060de747768360ba70a7c0 Mon Sep 17 00:00:00 2001
2From: Alexey Khoroshilov <khoroshilov@ispras.ru>
3Date: Fri, 12 Aug 2016 01:05:09 +0300
4Subject: USB: serial: mos7840: fix non-atomic allocation in write path
5
6From: Alexey Khoroshilov <khoroshilov@ispras.ru>
7
8commit 3b7c7e52efda0d4640060de747768360ba70a7c0 upstream.
9
10There is an allocation with GFP_KERNEL flag in mos7840_write(),
11while it may be called from interrupt context.
12
13Follow-up for commit 191252837626 ("USB: kobil_sct: fix non-atomic
14allocation in write path")
15
16Found by Linux Driver Verification project (linuxtesting.org).
17
18Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
19Signed-off-by: Johan Hovold <johan@kernel.org>
20Signed-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 }