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)
committerTakashi Iwai <tiwai@suse.de>
Thu, 22 Aug 2019 08:33:12 +0000 (10:33 +0200)
commitf9f0e9ed350e15d51ad07364b4cf910de50c472a
tree3b983a9c13686a2b8463a4ae996c14b125db498d
parent1bc8d18c75fef3b478dbdfef722aae09e2a9fde7
ALSA: usb-audio: Check mixer unit bitmap yet more strictly

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>
sound/usb/mixer.c