Skip to content

Commit e53f47f

Browse files
xdek42tiwai
authored andcommitted
ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface()
There may be a bad USB audio device with a USB ID of (0x04fa, 0x4201) and the number of it's interfaces less than 4, an out-of-bounds read bug occurs when parsing the interface descriptor for this device. Fix this by checking the number of interfaces. Signed-off-by: Dongxiang Ke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 8d44e60 commit e53f47f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/usb/stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
11061106
* Dallas DS4201 workaround: It presents 5 altsettings, but the last
11071107
* one misses syncpipe, and does not produce any sound.
11081108
*/
1109-
if (chip->usb_id == USB_ID(0x04fa, 0x4201))
1109+
if (chip->usb_id == USB_ID(0x04fa, 0x4201) && num >= 4)
11101110
num = 4;
11111111

11121112
for (i = 0; i < num; i++) {

0 commit comments

Comments
 (0)