ALSA: usb-audio: Add sanity checks in v2 clock parsers
authorTakashi Iwai <tiwai@suse.de>
Tue, 21 Nov 2017 16:28:06 +0000 (17:28 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Nov 2017 16:50:34 +0000 (17:50 +0100)
commit0a62d6c966956d77397c32836a5bbfe3af786fc1
tree6dcce2c8bb1369d171bf085fa3ee3e9f6f661615
parent8428a8ebde2db1e988e41a58497a28beb7ce1705
ALSA: usb-audio: Add sanity checks in v2 clock parsers

The helper functions to parse and look for the clock source, selector
and multiplier unit may return the descriptor with a too short length
than required, while there is no sanity check in the caller side.
Add some sanity checks in the parsers, at least, to guarantee the
given descriptor size, for avoiding the potential crashes.

Fixes: 79f920fbff56 ("ALSA: usb-audio: parse clock topology of UAC2 devices")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/clock.c