ChangeSet 1.1474.148.10, 2004/01/23 15:56:38-08:00, oliver@neukum.org [PATCH] USB: fix dma to stack in ti driver you cannot use usb_bulk_msg() on buffers on the stack. drivers/usb/misc/tiglusb.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff -Nru a/drivers/usb/misc/tiglusb.c b/drivers/usb/misc/tiglusb.c --- a/drivers/usb/misc/tiglusb.c Tue Jan 27 15:13:43 2004 +++ b/drivers/usb/misc/tiglusb.c Tue Jan 27 15:13:43 2004 @@ -161,7 +161,7 @@ int bytes_to_read = 0; int bytes_read = 0; int result = 0; - char buffer[BULK_RCV_MAX]; + char *buffer; unsigned int pipe; if (*f_pos) @@ -173,6 +173,10 @@ if (!s->dev) return -EIO; + buffer = kmalloc(BULK_RCV_MAX, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + bytes_to_read = (count >= BULK_RCV_MAX) ? BULK_RCV_MAX : count; pipe = usb_rcvbulkpipe (s->dev, 1); @@ -203,6 +207,7 @@ } out: + kfree(buffer); return ret ? ret : bytes_read; } @@ -214,7 +219,7 @@ int bytes_to_write = 0; int bytes_written = 0; int result = 0; - char buffer[BULK_SND_MAX]; + char *buffer; unsigned int pipe; if (*f_pos) @@ -226,6 +231,10 @@ if (!s->dev) return -EIO; + buffer = kmalloc(BULK_SND_MAX, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + bytes_to_write = (count >= BULK_SND_MAX) ? BULK_SND_MAX : count; if (copy_from_user (buffer, buf, bytes_to_write)) { ret = -EFAULT; @@ -258,6 +267,7 @@ } out: + kfree(buffer); return ret ? ret : bytes_written; }