mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
ALSA: usb-audio: Validate MS endpoint descriptors
commit e84749a78d upstream.
snd_usbmidi_get_ms_info() may access beyond the border when a
malformed descriptor is passed. This patch adds the sanity checks of
the given MS endpoint descriptors, and skips invalid ones.
Reported-by: syzbot+6bb23a5d5548b93c94aa@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210510150659.17710-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ad7f8cced3
commit
e5ffa75afb
@@ -1889,8 +1889,12 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi,
|
||||
ms_ep = find_usb_ms_endpoint_descriptor(hostep);
|
||||
if (!ms_ep)
|
||||
continue;
|
||||
if (ms_ep->bLength <= sizeof(*ms_ep))
|
||||
continue;
|
||||
if (ms_ep->bNumEmbMIDIJack > 0x10)
|
||||
continue;
|
||||
if (ms_ep->bLength < sizeof(*ms_ep) + ms_ep->bNumEmbMIDIJack)
|
||||
continue;
|
||||
if (usb_endpoint_dir_out(ep)) {
|
||||
if (endpoints[epidx].out_ep) {
|
||||
if (++epidx >= MIDI_MAX_ENDPOINTS) {
|
||||
|
||||
Reference in New Issue
Block a user