]> 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)
committerSasha Levin <alexander.levin@verizon.com>
Mon, 12 Sep 2016 18:53:12 +0000 (14:53 -0400)
[ Upstream commit 5a5a1d614287a647b36dff3f40c2b0ceabbc83ec ]

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>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/usb/serial/mos7720.c

index dfd728a263d29bbc522e20d52448c7da4c977fc9..c3b8ae36042471acccc8dd6e67bc4d4e565726e9 100644 (file)
@@ -1239,7 +1239,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)
                        goto exit;
        }