Skip to content

Commit

Permalink
USB: Do not pass negative length to snoop_urb()
Browse files Browse the repository at this point in the history
When `echo Y > /sys/module/usbcore/parameters/usbfs_snoop` and
usb_control_msg() returns error, a lot of kernel memory is dumped to dmesg
until unhandled kernel paging request occurs.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Michal Sojka authored and Greg Kroah-Hartman committed Mar 23, 2011
1 parent 4bbba11 commit 9d02b42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
tbuf, ctrl.wLength, tmo);
usb_lock_device(dev);
snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE,
tbuf, i);
tbuf, max(i, 0));
if ((i > 0) && ctrl.wLength) {
if (copy_to_user(ctrl.data, tbuf, i)) {
free_page((unsigned long)tbuf);
Expand Down

0 comments on commit 9d02b42

Please sign in to comment.