Commit c3ca41be authored by Martin Diehl's avatar Martin Diehl Committed by Greg Kroah-Hartman

[PATCH] USB: fix stack usage in pl2303 driver

Arghh - while trying to follow this I just realized the pl2303 is DMA'ing
to the stack - not good!
Could you please just try with the patch below. I'm not sure if this might
cause the MA620 trouble but it's definedly a bug and maybe it improves
things for you...
parent ba6f837d
...@@ -403,7 +403,7 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp) ...@@ -403,7 +403,7 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
{ {
struct termios tmp_termios; struct termios tmp_termios;
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
unsigned char buf[10]; unsigned char *buf;
int result; int result;
if (port_paranoia_check (port, __FUNCTION__)) if (port_paranoia_check (port, __FUNCTION__))
...@@ -414,6 +414,10 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp) ...@@ -414,6 +414,10 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
usb_clear_halt(serial->dev, port->write_urb->pipe); usb_clear_halt(serial->dev, port->write_urb->pipe);
usb_clear_halt(serial->dev, port->read_urb->pipe); usb_clear_halt(serial->dev, port->read_urb->pipe);
buf = kmalloc(10, GFP_KERNEL);
if (buf==NULL)
return -ENOMEM;
#define FISH(a,b,c,d) \ #define FISH(a,b,c,d) \
result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0), \ result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0), \
b, a, c, d, buf, 1, 100); \ b, a, c, d, buf, 1, 100); \
...@@ -433,6 +437,8 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp) ...@@ -433,6 +437,8 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0); FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0); FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
kfree(buf);
/* Setup termios */ /* Setup termios */
if (port->tty) { if (port->tty) {
pl2303_set_termios (port, &tmp_termios); pl2303_set_termios (port, &tmp_termios);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment