ChangeSet 1.1290.15.19, 2004/03/10 11:55:07-08:00, lists@mdiehl.de

[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...


 drivers/usb/serial/pl2303.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	Wed Mar 17 15:48:27 2004
+++ b/drivers/usb/serial/pl2303.c	Wed Mar 17 15:48:27 2004
@@ -390,7 +390,7 @@
 {
 	struct termios tmp_termios;
 	struct usb_serial *serial = port->serial;
-	unsigned char buf[10];
+	unsigned char *buf;
 	int result;
 
 	if (port_paranoia_check (port, __FUNCTION__))
@@ -401,6 +401,10 @@
 	usb_clear_halt(serial->dev, port->write_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)								\
 	result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0),	\
 			       b, a, c, d, buf, 1, 100);			\
@@ -419,6 +423,8 @@
 	SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 1);
 	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
 	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
+
+	kfree(buf);
 
 	/* Setup termios */
 	if (port->tty) {
