ALSA: usb-audio: Check mixer unit bitmap yet more strictly
authorTakashi Iwai <tiwai@suse.de>
Tue, 20 Aug 2019 19:43:42 +0000 (21:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:22:08 +0000 (10:22 +0200)
commitc94c0bf878bf299dcc957c8a3d85ee61caa887b2
tree0f63adf46b7661dfa9cb64c95bffbcaab089770f
parent5dd2db1ab0062052af9e6da8146f9655c94f8378
ALSA: usb-audio: Check mixer unit bitmap yet more strictly

commit f9f0e9ed350e15d51ad07364b4cf910de50c472a upstream.

The bmControls (for UAC1) or bmMixerControls (for UAC2/3) bitmap has a
variable size depending on both input and output pins.  Its size is to
fit with input * output bits.  The problem is that the input size
can't be determined simply from the unit descriptor itself but it
needs to parse the whole connected sources.  Although the
uac_mixer_unit_get_channels() tries to check some possible overflow of
this bitmap, it's incomplete due to the lack of the  evaluation of
input pins.

For covering possible overflows, this patch adds the bitmap overflow
check in the loop of input pins in parse_audio_mixer_unit().

Fixes: 0bfe5e434e66 ("ALSA: usb-audio: Check mixer unit descriptors more strictly")
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