usb: Use well-known descriptor sizes when parsing configuration
authorJulius Werner <jwerner@chromium.org>
Fri, 19 Jul 2013 20:12:08 +0000 (13:12 -0700)
committerMarek Vasut <marex@denx.de>
Mon, 26 Aug 2013 19:56:34 +0000 (21:56 +0200)
commiteaf3e613ea6f0dc95c94a93997ad62785fe2969c
tree37cad21b6993b25dc9b82245cc84ec4db0780713
parent1572eadfbc8e0ec7e6a4b80034eb4c30abe96739
usb: Use well-known descriptor sizes when parsing configuration

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.

Change-Id: I16f69dfdd6793aa0fe930b5148d4521f3e5c3090
Signed-off-by: Julius Werner <jwerner@chromium.org>
common/usb.c
common/usb_hub.c