]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb-audio: Check mixer unit descriptors more strictly
authorTakashi Iwai <tiwai@suse.de>
Wed, 19 Dec 2018 13:04:47 +0000 (14:04 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 7 Jan 2019 09:46:27 +0000 (10:46 +0100)
commit32969a319fa23194789e65e7a98774e02aabffa0
tree870ae33ee380a572e2faed76bdb7694b04f5b489
parentff66d92197fdc8a8f310422c5934b73a73f72c81
ALSA: usb-audio: Check mixer unit descriptors more strictly

We've had some sanity checks of the mixer unit descriptors but they
are too loose and some corner cases are overlooked.  Add more strict
checks in uac_mixer_unit_get_channels() for avoiding possible OOB
accesses by malformed descriptors.

This also changes the semantics of uac_mixer_unit_get_channels()
slightly.  Now it returns zero for the cases where the descriptor
lacks of bmControls instead of -EINVAL.  Then the caller side skips
the mixer creation for such unit while it keeps parsing it.
This corresponds to the case like Maya44.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c