ALSA: usb-audio: Validate MS endpoint descriptors
authorTakashi Iwai <tiwai@suse.de>
Mon, 10 May 2021 15:06:59 +0000 (17:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 May 2021 09:29:06 +0000 (11:29 +0200)
commit44a9a71cc408ecc2dd4190651d6e6753c6af63ef
treeab0b5552c52a5e150b39ad5b46610dbeacf4ac88
parent02303132de22be08bc90e99b3e1eca20b8284493
ALSA: usb-audio: Validate MS endpoint descriptors

commit e84749a78dc82bc545f12ce009e3dbcc2c5a8a91 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>
sound/usb/midi.c