USB: oti6858: fix DMA buffer on stack
authorJohan Hovold <jhovold@gmail.com>
Mon, 28 Dec 2009 22:01:56 +0000 (23:01 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:53:56 +0000 (14:53 -0800)
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/oti6858.c

index c644e26394b47360e1a1d52c684d59d16f16d609..2ae97e7195c67869df91730926da1829ea2d5a22 100644 (file)
@@ -302,7 +302,7 @@ void send_data(struct work_struct *work)
        struct usb_serial_port *port = priv->port;
        int count = 0, result;
        unsigned long flags;
-       unsigned char allow;
+       u8 *allow;
 
        dbg("%s(port = %d)", __func__, port->number);
 
@@ -321,13 +321,20 @@ void send_data(struct work_struct *work)
                count = port->bulk_out_size;
 
        if (count != 0) {
+               allow = kmalloc(1, GFP_KERNEL);
+               if (!allow) {
+                       dev_err(&port->dev, "%s(): kmalloc failed\n",
+                                       __func__);
+                       return;
+               }
                result = usb_control_msg(port->serial->dev,
                                usb_rcvctrlpipe(port->serial->dev, 0),
                                OTI6858_REQ_T_CHECK_TXBUFF,
                                OTI6858_REQ_CHECK_TXBUFF,
-                               count, 0, &allow, 1, 100);
-               if (result != 1 || allow != 0)
+                               count, 0, allow, 1, 100);
+               if (result != 1 || *allow != 0)
                        count = 0;
+               kfree(allow);
        }
 
        if (count == 0) {