]> www.infradead.org Git - users/dwmw2/linux.git/commit
ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks
authorTakashi Iwai <tiwai@suse.de>
Wed, 23 Dec 2020 17:45:57 +0000 (18:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 19:09:12 +0000 (20:09 +0100)
commit913869e458ca148810dba141208514adeea17132
treecdf08c94e1c3c770f3297a14b05fbc9216c25d03
parent863f3efde4c67469ea482c66ce4bd974fe12989e
ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks

commit c06ccf3ebb7503706ea49fd248e709287ef385a3 upstream.

The calculation of in_cables and out_cables bitmaps are done with the
bit shift by the value from the descriptor, which is an arbitrary
value, and can lead to UBSAN shift-out-of-bounds warnings.

Fix it by filtering the bad descriptor values with the check of the
upper bound 0x10 (the cable bitmaps are 16 bits).

Reported-by: syzbot+92e45ae45543f89e8c88@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201223174557.10249-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