Skip to content

Commit

Permalink
ALSA: usb-audio: Fix incorrect size check for processing/extension units
Browse files Browse the repository at this point in the history
The recently introduced unit descriptor validation had some bug for
processing and extension units, it counts a bControlSize byte twice so
it expected a bigger size than it should have been.  This seems
resulting in a probe error on a few devices.

Fix the calculation for proper checks of PU and EU.

Fixes: 57f8770 ("ALSA: usb-audio: More validations of descriptor units")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191114165613.7422-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 14, 2019
1 parent cc9dbfa commit 976a68f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/usb/validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ static bool validate_processing_unit(const void *p,
switch (v->protocol) {
case UAC_VERSION_1:
default:
/* bNrChannels, wChannelConfig, iChannelNames, bControlSize */
len += 1 + 2 + 1 + 1;
if (d->bLength < len) /* bControlSize */
/* bNrChannels, wChannelConfig, iChannelNames */
len += 1 + 2 + 1;
if (d->bLength < len + 1) /* bControlSize */
return false;
m = hdr[len];
len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */
Expand Down

0 comments on commit 976a68f

Please sign in to comment.