Re: Malta + USB on 2.4, anyone?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux