Hi Alan,

> > By the way Alan, maybe there should be a check that the maxpacket size
> > is valid.  I have a device that sometimes returns a maxpacket size of zero
> > (in fact the whole 8 bytes read is zero - maybe nothing was read but the
> > error reporting logic is wrong somewhere?).  Given the number of bad
> > USB devices out there, maybe it is wise to add a sanity check here, and
> > fail (-EIO?) if a rubbish value is seen.  What do you think?
> 
> It wouldn't be hard to do.  How much would it end up helping?  It seems to 
> me that ep0 maxpacket is a pretty hard thing to mess up -- surely a bad 
> value would cause problems the very first time anyone tried to use the 
> device.
>
> Like in your case.  Setting the maxpacket size to 0 will effectively 
> disable endpoint 0 -- no URBs will be accepted.  So the attempt to read 
> the full device descriptor would fail and the device would be rejected.  
> Would adding the additional test improve this behavior at all?

right now it would make no difference.  However it might matter one day.
At the moment there is an implicit check on the value returned by the
hardware.  I'm proposing an explicit check.  Implicit checks tend to go
away quietly when code is rearranged, while explicit checks don't.  So
as a general rule I think it is wise to catch problems explicitly as early as
possible.  I will send a patch if the next football match in the Euro is
boring enough.

All the best,

Duncan.


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to