android_kernel_samsung_msm8976/sound/usb
Takashi Iwai 4e545f2462 ALSA: usb-audio: Always check descriptor sizes in parser code
commit 3e96d7280f16e2f787307f695a31296b9e4a1cd7 upstream.

There are a few places where we access the data without checking the
actual object size from the USB audio descriptor.  This may result in
OOB access, as recently reported.

This patch addresses these missing checks.  Most of added codes are
simple bLength checks in the caller side.  For the input and output
terminal parsers, we put the length check in the parser functions.
For the input terminal, a new argument is added to distinguish between
UAC1 and the rest, as they treat different objects.

Reported-by: Mathias Payer <mathias.payer@nebelwelt.net>
Reported-by: Hui Peng <benquike@163.com>
Tested-by: Hui Peng <benquike@163.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.16:
 - Drop changes in parse_audio_input_terminal() and UAC3 handling
 - Adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 22:10:17 +02:00
..
6fire
caiaq
misc
usx2y
Kconfig
Makefile
card.c ALSA: usb-audio: Always check descriptor sizes in parser code 2019-07-27 22:10:17 +02:00
card.h
clock.c ALSA: usb-audio: Add sanity checks in v2 clock parsers 2019-07-27 21:46:06 +02:00
clock.h
debug.h
endpoint.c Merge tag 'LA.BR.1.3.6-03510-8976.0' into HEAD 2017-04-18 12:11:50 +02:00
endpoint.h
format.c
format.h
helper.c
helper.h
midi.c This is the 3.10.94 stable release 2017-04-18 17:12:56 +02:00
midi.h
mixer.c ALSA: usb-audio: Avoid access before bLength check in build_audio_procunit() 2019-07-27 22:10:17 +02:00
mixer.h ALSA: usb-audio: Kill stray URB at exiting 2018-08-20 12:15:26 +02:00
mixer_maps.c ALSA: usb-audio: add dB range mapping for some devices 2015-08-10 12:20:30 -07:00
mixer_quirks.c
mixer_quirks.h
pcm.c ALSA: usb-audio: clear SUBSTREAM_FLAG_SYNC_EP_STARTED on error 2019-07-27 22:10:16 +02:00
pcm.h
power.h
proc.c
proc.h
quirks-table.h ALSA: usb-audio: prevent CH345 multiport output SysEx corruption 2015-12-09 13:40:10 -05:00
quirks.c This is the 3.10.97 stable release 2017-04-18 17:17:20 +02:00
quirks.h
stream.c ALSA: usb-audio: Always check descriptor sizes in parser code 2019-07-27 22:10:17 +02:00
stream.h
usbaudio.h ALSA: usb-audio: prevent CH345 multiport output SysEx corruption 2015-12-09 13:40:10 -05:00