Hi, On Mon, Jul 01, 2013 at 09:56:37AM -0400, Alan Stern wrote: > On Mon, 1 Jul 2013, Felipe Balbi wrote: > > > bInterval must be within the range 1 - 16, > > That's true only for high speed and SuperSpeed. For low speed and full > speed, bInterval is allowed to range from 1 to 255. See p. 271 in the > USB-2 spec. > > > in order to catch drivers passing a too > > large bInterval (thus zeroing urb->interval), > > let's clamp() the argument to the allowed > > range. > > > > Signed-off-by: Felipe Balbi <balbi@xxxxxx> > > --- > > include/linux/usb.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/include/linux/usb.h b/include/linux/usb.h > > index a232b7e..0883e3a 100644 > > --- a/include/linux/usb.h > > +++ b/include/linux/usb.h > > @@ -1545,6 +1545,10 @@ static inline void usb_fill_int_urb(struct urb *urb, > > urb->transfer_buffer_length = buffer_length; > > urb->complete = complete_fn; > > urb->context = context; > > + > > + /* make sure interval is within allowed range */ > > + interval = clamp(interval, 1, 16); > > These lines should go within the first branch of the "if" statement > below. could you look at the newer version I sent as a reply to this and tell me what you think of it ? thanks -- balbi
Attachment:
signature.asc
Description: Digital signature