aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2009-12-28 17:01:46 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:53:50 -0500
commitf2b5cc834b69d2999b749144481de9a94f01bc48 (patch)
tree7cc9ef8bfecd272c946e4cec279ef555e479c174 /drivers/usb
parent6a9b15fed4dca1f90e41ae0cfe35aaa39a20f495 (diff)
USB: ch341: fix DMA buffer on stack
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/ch341.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 5e455f4a792e..2942c6d381d0 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -392,16 +392,22 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
392 struct usb_serial_port *port = tty->driver_data; 392 struct usb_serial_port *port = tty->driver_data;
393 int r; 393 int r;
394 uint16_t reg_contents; 394 uint16_t reg_contents;
395 uint8_t break_reg[2]; 395 uint8_t *break_reg;
396 396
397 dbg("%s()", __func__); 397 dbg("%s()", __func__);
398 398
399 break_reg = kmalloc(2, GFP_KERNEL);
400 if (!break_reg) {
401 dev_err(&port->dev, "%s - kmalloc failed\n", __func__);
402 return;
403 }
404
399 r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG, 405 r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
400 ch341_break_reg, 0, break_reg, sizeof(break_reg)); 406 ch341_break_reg, 0, break_reg, 2);
401 if (r < 0) { 407 if (r < 0) {
402 dev_err(&port->dev, "%s - USB control read error (%d)\n", 408 dev_err(&port->dev, "%s - USB control read error (%d)\n",
403 __func__, r); 409 __func__, r);
404 return; 410 goto out;
405 } 411 }
406 dbg("%s - initial ch341 break register contents - reg1: %x, reg2: %x", 412 dbg("%s - initial ch341 break register contents - reg1: %x, reg2: %x",
407 __func__, break_reg[0], break_reg[1]); 413 __func__, break_reg[0], break_reg[1]);
@@ -422,6 +428,8 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
422 if (r < 0) 428 if (r < 0)
423 dev_err(&port->dev, "%s - USB control write error (%d)\n", 429 dev_err(&port->dev, "%s - USB control write error (%d)\n",
424 __func__, r); 430 __func__, r);
431out:
432 kfree(break_reg);
425} 433}
426 434
427static int ch341_tiocmset(struct tty_struct *tty, struct file *file, 435static int ch341_tiocmset(struct tty_struct *tty, struct file *file,