]> git.hungrycats.org Git - linux/commitdiff
USB: serial: mos7720: fix non-atomic allocation in write path
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Thu, 11 Aug 2016 22:05:08 +0000 (01:05 +0300)
committerJiri Slaby <jslaby@suse.cz>
Fri, 23 Sep 2016 07:29:22 +0000 (09:29 +0200)
commit 5a5a1d614287a647b36dff3f40c2b0ceabbc83ec upstream.

There is an allocation with GFP_KERNEL flag in mos7720_write(),
while it may be called from interrupt context.

Follow-up for commit 191252837626 ("USB: kobil_sct: fix non-atomic
allocation in write path")

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/usb/serial/mos7720.c

index 84657e07dc5d6b914bd88da4697ab2f8c8b22de1..d40e1dccb998b167a0430afec1bdf823aef47cf9 100644 (file)
@@ -1249,7 +1249,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
 
        if (urb->transfer_buffer == NULL) {
                urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
-                                              GFP_KERNEL);
+                                              GFP_ATOMIC);
                if (urb->transfer_buffer == NULL) {
                        dev_err_console(port, "%s no more kernel memory...\n",
                                __func__);