* [PATCH] ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface()
@ 2022-09-06 2:49 Dongxiang Ke
2022-09-06 5:15 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Dongxiang Ke @ 2022-09-06 2:49 UTC (permalink / raw)
To: perex, tiwai; +Cc: gregkh, alsa-devel, Dongxiang Ke
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>
---
sound/usb/stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index ceb93d798182..40ce8a1cb318 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1105,7 +1105,7 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
* 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++) {
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface()
2022-09-06 2:49 [PATCH] ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface() Dongxiang Ke
@ 2022-09-06 5:15 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2022-09-06 5:15 UTC (permalink / raw)
To: Dongxiang Ke; +Cc: gregkh, alsa-devel, tiwai
On Tue, 06 Sep 2022 04:49:28 +0200,
Dongxiang Ke wrote:
>
> 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>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-06 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06 2:49 [PATCH] ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface() Dongxiang Ke
2022-09-06 5:15 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.