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:46:59 +0000 (11:46 +0200)
commitaf3ef8aaa2306e57e329b94a84e2c7b718497126
tree2ead8969bfbd5a4c08858cde7d64262ba62c0186
parent60296b2c026bbc8633975e731ea6f8b8f5bafbec
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