Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174892
b: refs/heads/master
c: 8e08b97
h: refs/heads/master
v: v3
  • Loading branch information
David Vrabel authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent dadfdee commit f1c4dee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 294a39e7829dfd663e6c5c94cede0c6a0c13e37f
refs/heads/master: 8e08b9766b50826e12139a821b6b3bdfcadcceda
22 changes: 18 additions & 4 deletions trunk/drivers/usb/core/urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,27 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
case USB_ENDPOINT_XFER_ISOC:
case USB_ENDPOINT_XFER_INT:
/* too small? */
if (urb->interval <= 0)
return -EINVAL;
switch (dev->speed) {
case USB_SPEED_VARIABLE:
if (urb->interval < 6)
return -EINVAL;
break;
default:
if (urb->interval <= 0)
return -EINVAL;
break;
}
/* too big? */
switch (dev->speed) {
case USB_SPEED_SUPER: /* units are 125us */
/* Handle up to 2^(16-1) microframes */
if (urb->interval > (1 << 15))
return -EINVAL;
max = 1 << 15;
case USB_SPEED_VARIABLE:
if (urb->interval > 16)
return -EINVAL;
break;
case USB_SPEED_HIGH: /* units are microframes */
/* NOTE usb handles 2^15 */
if (urb->interval > (1024 * 8))
Expand All @@ -461,8 +473,10 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
default:
return -EINVAL;
}
/* Round down to a power of 2, no more than max */
urb->interval = min(max, 1 << ilog2(urb->interval));
if (dev->speed != USB_SPEED_VARIABLE) {
/* Round down to a power of 2, no more than max */
urb->interval = min(max, 1 << ilog2(urb->interval));
}
}

return usb_hcd_submit_urb(urb, mem_flags);
Expand Down

0 comments on commit f1c4dee

Please sign in to comment.