[U-Boot] [PATCH] usb: Use well-known descriptor sizes when parsing configuration

Albert ARIBAUD albert.u.boot at aribaud.net
Sat Jul 13 09:23:31 CEST 2013


Hi Julius,

On Fri, 12 Jul 2013 17:30:16 -0700, Julius Werner
<jwerner at chromium.org> wrote:

> The existing USB configuration parsing code relies on the descriptors'
> own length values when reading through the configuration blob. Since the
> size of those descriptors is always well-defined, we should rather use
> the known sizes instead of trusting device-provided values to be
> correct. Also adds some safety to potential out-of-order descriptors.

Question from the offspring of an USB ignoramus and a Devil's advocate:
if the device, rather than relying on well-known sizes,  provides its
own values for lengths, maybe it's because it will let you read or write
only that much, and if you try to read more, you might put the device
in an unclean, or worse, non-functional, state?

In that case, trying to read a well-known length instead could cause
more issues than reading the device-maker-specified length, could it
not?

BTW, what is the real-world issue (hardware, conditions, expected
outcome, actual outcome) which made this change needed?

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list