usb: fallback safely when a configuration descriptor is too large
authorVincent Palatin <vpalatin@chromium.org>
Tue, 24 Jul 2012 07:12:02 +0000 (07:12 +0000)
committerMarek Vasut <marex@denx.de>
Mon, 22 Oct 2012 06:25:07 +0000 (08:25 +0200)
commit8b8d779dacc149be0607dfc1b399bbdb62e57108
tree7198df8ddee428b5cf7094fb401db53958f3b65f
parente81e79ede1aa1052735b9ee9a364f99b93605a08
usb: fallback safely when a configuration descriptor is too large

When a USB configuration descriptor was larger than our USB buffer
(512 bytes), we were skipping the full descriptor reading but then we
were still parsing and using it, triggering memory corruptions.
Now in that case, it just skips this device enumeration and displays the
appropriate message to the user, so he can fix the buffer if he wants.

This bug was triggered by some UVC webcams which have very large
configuration descriptors (e.g. a couple of kB) describing all their
supported video encodings.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
common/usb.c