linux-mips
[Top] [All Lists]

Re: Malta + USB on 2.4, anyone?

To: jsun@mvista.com
Subject: Re: Malta + USB on 2.4, anyone?
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 01 Aug 2003 17:26:23 +0900 (JST)
Cc: macro@ds2.pg.gda.pl, linux-mips@linux-mips.org
In-reply-to: <20030731111506.F14914@mvista.com>
Organization: TOSHIBA Personal Computer System Corporation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <Pine.GSO.3.96.1030731121705.17497D-100000@delta.ds2.pg.gda.pl> <20030731103629.D14914@mvista.com> <20030731111506.F14914@mvista.com>
Sender: linux-mips-bounce@linux-mips.org
>>>>> On Thu, 31 Jul 2003 11:15:06 -0700, Jun Sun <jsun@mvista.com> said:
jsun> I suspect the main UHCI driver does not get cache flushing or
jsun> bus/virt address right.

It seems usb_control_msg is not safe with an unaligned buffer.  Is
this patch solve your problem?

diff -u linux-2.4.21/drivers/usb/usb.c linux/drivers/usb/usb.c
--- linux-2.4.21/drivers/usb/usb.c      Tue Jul 15 13:49:34 2003
+++ linux/drivers/usb/usb.c     Tue Jul 15 21:20:44 2003
@@ -1172,9 +1172,24 @@
 {
        struct usb_ctrlrequest *dr = kmalloc(sizeof(struct usb_ctrlrequest), 
GFP_KERNEL);
        int ret;
+#ifdef __mips__ /* BUG??? */
+       void *tmpdata = NULL;
+#endif
        
        if (!dr)
                return -ENOMEM;
+#ifdef __mips__ /* BUG??? */
+       if (size) {
+               tmpdata = kmalloc(size, GFP_KERNEL);
+               if (!data) {
+                       kfree(dr);
+                       return -ENOMEM;
+               }
+               memcpy(tmpdata, data, size);
+       } else {
+               tmpdata = data;
+       }
+#endif
 
        dr->bRequestType = requesttype;
        dr->bRequest = request;
@@ -1184,7 +1199,15 @@
 
        //dbg("usb_control_msg");       
 
+#ifdef __mips__ /* BUG??? */
+       ret = usb_internal_control_msg(dev, pipe, dr, tmpdata, size, timeout);
+       if (size) {
+               memcpy(data, tmpdata, size);
+               kfree(tmpdata);
+       }
+#else
        ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout);
+#endif
 
        kfree(dr);
 
---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>