Commit 88bcb34e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] usb_submit_urb fix for broken usb devices

added check for wMaxPacketSize of 0, which is a messed up device, but
seems to be legal according to the USB spec.

Thanks to Johannes for figuring out the problem, and providing an
original version of this patch.
parent d8a71dcf
......@@ -1162,10 +1162,15 @@ struct urb * usb_get_urb(struct urb *urb)
*/
int usb_submit_urb(struct urb *urb, int mem_flags)
{
if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op)
if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op) {
if (usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)) <= 0) {
err("%s: pipe %x has invalid size (<= 0)", __FUNCTION__, urb->pipe);
return -EMSGSIZE;
}
return urb->dev->bus->op->submit_urb(urb, mem_flags);
else
return -ENODEV;
}
return -ENODEV;
}
/*-------------------------------------------------------------------*/
......
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