Skip to content

Commit 976a68f

Browse files
committed
ALSA: usb-audio: Fix incorrect size check for processing/extension units
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: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent cc9dbfa commit 976a68f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/usb/validate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ static bool validate_processing_unit(const void *p,
8181
switch (v->protocol) {
8282
case UAC_VERSION_1:
8383
default:
84-
/* bNrChannels, wChannelConfig, iChannelNames, bControlSize */
85-
len += 1 + 2 + 1 + 1;
86-
if (d->bLength < len) /* bControlSize */
84+
/* bNrChannels, wChannelConfig, iChannelNames */
85+
len += 1 + 2 + 1;
86+
if (d->bLength < len + 1) /* bControlSize */
8787
return false;
8888
m = hdr[len];
8989
len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */

0 commit comments

Comments
 (0)