]> git.itanic.dy.fi Git - linux-stable/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jan 2019 08:51:06 +0000 (09:51 +0100)
commitb389f9c4c97ac438174b9409b372208dea62821f
tree59b6f0f7502b12906706b856189fc4fe1c417ce4
parent8ee6f180d56fe760b275ab7f060c7b12fc05d7b7
ALSA: usb-audio: Check mixer unit descriptors more strictly

commit 0bfe5e434e6665b3590575ec3c5e4f86a1ce51c9 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/mixer.c