Alan Stern wrote:

I'd go for something like this patch.  It resolves a FIXME and
makes a small behavior change:  if the period is too big, it no
longer automagically limits it except for the case of full speed
interrupt transfers.  (Which continue with the current behavior,
making a lot of drivers happier on OHCI.)

Comments?   Perhaps the bounds tests should use "limit - 1" to
behave better, but they've behaved so far (most periods are short
enough not to have issues).


A few comments.

You can't set periodic_iso_limit to 1024 on UHCI, because the driver
reserves a grace period of 10 frames.  The largest legal value is
therefore UHCI_NUMFRAMES - 11.  Also, UHCI doesn't require iso. periods to
be powers of 2.

Last I checked, it expected period == 1 (which is a power of 2) ... but that could have changed since then! :)

But the "power-of-two" restriction comes from the USB spec, which says
that all ISO periods are encoded as log2.  I suspect some people have
been generalizing that since endpoint_descriptor.bInterval == 1 means
"1 frame", the formula is "bInterval" not "(1 << (bInterval-1))" frames.

The generic checks can't, of necessity, cover every contingency.  There's
actually a CAN_SCHEDULE_FRAMES value that I thought about using to init
the periodic_iso_limit for UHCI ... but that wouldn't work since that
value is "UHCI_NUMFRAMES - 24" (not 11?), which would break the log2
logic a bit later.


There's another check that could be added to usb_submit_urb() if you're
feeling particularly paranoid.  In the loop where the iso. descriptors'
status and actual_length fields are initialized, you could make sure that
offset + len <= transfer_buffer_length.

All I had time for was the quick patch to expose this information from the HCDs, and to use it to improve the current approximations.

You're right, that'd be a good check since otherwise a bad ISO request
could corrupt memory.

- Dave





Alan Stern







-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to