mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
4bbba111d9
commit
9d02b42614
1 changed files with 1 additions and 1 deletions
|
@ -802,7 +802,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
|
||||||
tbuf, ctrl.wLength, tmo);
|
tbuf, ctrl.wLength, tmo);
|
||||||
usb_lock_device(dev);
|
usb_lock_device(dev);
|
||||||
snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE,
|
snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE,
|
||||||
tbuf, i);
|
tbuf, max(i, 0));
|
||||||
if ((i > 0) && ctrl.wLength) {
|
if ((i > 0) && ctrl.wLength) {
|
||||||
if (copy_to_user(ctrl.data, tbuf, i)) {
|
if (copy_to_user(ctrl.data, tbuf, i)) {
|
||||||
free_page((unsigned long)tbuf);
|
free_page((unsigned long)tbuf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue