Commit 668a9541 authored by Christopher Li's avatar Christopher Li Committed by Greg K-H

[PATCH] USB: bug fix in usbdevfs

I am sorry that the last patch about 32 bit compat ioctl on
64 bit kernel actually breaks the usbdevfs. That is on the current
BK tree. I am retarded. 

Here is the patch to fix it. Tested with USB hard disk and webcam
in both 32bit compatible mode and native 64bit mode.

Again, sorry about that.


From: Christopher Li <chrisl@vmware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a81e7ecc
...@@ -1032,15 +1032,15 @@ static int processcompl(struct async *as, void __user * __user *arg) ...@@ -1032,15 +1032,15 @@ static int processcompl(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count)) if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT; return -EFAULT;
if (!(usb_pipeisoc(urb->pipe))) if (usb_pipeisoc(urb->pipe)) {
return 0; for (i = 0; i < urb->number_of_packets; i++) {
for (i = 0; i < urb->number_of_packets; i++) { if (put_user(urb->iso_frame_desc[i].actual_length,
if (put_user(urb->iso_frame_desc[i].actual_length, &userurb->iso_frame_desc[i].actual_length))
&userurb->iso_frame_desc[i].actual_length)) return -EFAULT;
return -EFAULT; if (put_user(urb->iso_frame_desc[i].status,
if (put_user(urb->iso_frame_desc[i].status, &userurb->iso_frame_desc[i].status))
&userurb->iso_frame_desc[i].status)) return -EFAULT;
return -EFAULT; }
} }
free_async(as); free_async(as);
...@@ -1126,7 +1126,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg) ...@@ -1126,7 +1126,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg)
if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg)) if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg))
return -EFAULT; return -EFAULT;
return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb __user *)arg)->iso_frame_desc, arg); return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg);
} }
static int processcompl_compat(struct async *as, void __user * __user *arg) static int processcompl_compat(struct async *as, void __user * __user *arg)
...@@ -1146,15 +1146,15 @@ static int processcompl_compat(struct async *as, void __user * __user *arg) ...@@ -1146,15 +1146,15 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count)) if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT; return -EFAULT;
if (!(usb_pipeisoc(urb->pipe))) if (usb_pipeisoc(urb->pipe)) {
return 0; for (i = 0; i < urb->number_of_packets; i++) {
for (i = 0; i < urb->number_of_packets; i++) { if (put_user(urb->iso_frame_desc[i].actual_length,
if (put_user(urb->iso_frame_desc[i].actual_length, &userurb->iso_frame_desc[i].actual_length))
&userurb->iso_frame_desc[i].actual_length)) return -EFAULT;
return -EFAULT; if (put_user(urb->iso_frame_desc[i].status,
if (put_user(urb->iso_frame_desc[i].status, &userurb->iso_frame_desc[i].status))
&userurb->iso_frame_desc[i].status)) return -EFAULT;
return -EFAULT; }
} }
free_async(as); free_async(as);
...@@ -1177,10 +1177,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) ...@@ -1177,10 +1177,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
{ {
struct async *as; struct async *as;
printk("reapurbnblock\n");
if (!(as = async_getcompleted(ps))) if (!(as = async_getcompleted(ps)))
return -EAGAIN; return -EAGAIN;
printk("reap got as %p\n", as);
return processcompl_compat(as, (void __user * __user *)arg); return processcompl_compat(as, (void __user * __user *)arg);
} }
......
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