diff options
author | Dongxiang Ke <kdx.glider@gmail.com> | 2022-09-06 10:49:28 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-09-15 12:23:52 +0200 |
commit | 91904870370fd986c29719846ed76d559de43251 (patch) | |
tree | a4a084a3fc681b40c5d130ab6c24589cbffba50a /sound/usb | |
parent | 35d1ac9863636dcb0042b0cf3dbc14bc23b07757 (diff) | |
download | linux-stable-91904870370fd986c29719846ed76d559de43251.tar.gz linux-stable-91904870370fd986c29719846ed76d559de43251.tar.bz2 linux-stable-91904870370fd986c29719846ed76d559de43251.zip |
ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface()
commit e53f47f6c1a56d2af728909f1cb894da6b43d9bf upstream.
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 <kdx.glider@gmail.com>
Link: https://lore.kernel.org/r/20220906024928.10951-1-kdx.glider@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/stream.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 7b86bf38f10e..133a66a7f90e 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -502,7 +502,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) * Dallas DS4201 workaround: It presents 5 altsettings, but the last * one misses syncpipe, and does not produce any sound. */ - if (chip->usb_id == USB_ID(0x04fa, 0x4201)) + if (chip->usb_id == USB_ID(0x04fa, 0x4201) && num >= 4) num = 4; for (i = 0; i < num; i++) { |