diff options
author | Michal Sojka <sojkam1@fel.cvut.cz> | 2011-03-15 11:41:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-23 16:14:16 -0400 |
commit | 9d02b42614149ebccf12c9c580601ed01bd83070 (patch) | |
tree | 010f30f5acba34e61aeff61e47aeaad8306ce1ff /drivers/usb/core | |
parent | 4bbba111d94781d34081c37856bbc5eb33f6c72a (diff) |
USB: Do not pass negative length to snoop_urb()
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>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/devio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index a7131ad630f9..37518dfdeb98 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -802,7 +802,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
802 | tbuf, ctrl.wLength, tmo); | 802 | tbuf, ctrl.wLength, tmo); |
803 | usb_lock_device(dev); | 803 | usb_lock_device(dev); |
804 | snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, | 804 | snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, |
805 | tbuf, i); | 805 | tbuf, max(i, 0)); |
806 | if ((i > 0) && ctrl.wLength) { | 806 | if ((i > 0) && ctrl.wLength) { |
807 | if (copy_to_user(ctrl.data, tbuf, i)) { | 807 | if (copy_to_user(ctrl.data, tbuf, i)) { |
808 | free_page((unsigned long)tbuf); | 808 | free_page((unsigned long)tbuf); |