linux_dsm_epyc7002/sound/usb/line6
Takashi Iwai f42cf1e7b8 ALSA: line6: Fix racy initialization of LINE6 MIDI
commit 05ca447630334c323c9e2b788b61133ab75d60d3 upstream.

The initialization of MIDI devices that are found on some LINE6
drivers are currently done in a racy way; namely, the MIDI buffer
instance is allocated and initialized in each private_init callback
while the communication with the interface is already started via
line6_init_cap_control() call before that point.  This may lead to
Oops in line6_data_received() when a spurious event is received, as
reported by syzkaller.

This patch moves the MIDI initialization to line6_init_cap_control()
as well instead of the too-lately-called private_init for avoiding the
race.  Also this reduces slightly more lines, so it's a win-win
change.

Reported-by: syzbot+0d2b3feb0a2887862e06@syzkallerlkml..appspotmail.com
Link: https://lore.kernel.org/r/000000000000a4be9405c28520de@google.com
Link: https://lore.kernel.org/r/20210517132725.GA50495@hyeyoo
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210518083939.1927-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-26 12:06:51 +02:00
..
capture.c ALSA: line6: Perform sanity check for each URB creation 2020-07-10 16:29:18 +02:00
capture.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
driver.c ALSA: line6: Fix racy initialization of LINE6 MIDI 2021-05-26 12:06:51 +02:00
driver.h ALSA: line6: add hw monitor volume control for POD HD500 2020-07-13 18:04:14 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
midi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
midi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
midibuf.c ALSA: line6: Fix endless MIDI read loop 2020-03-09 11:00:45 +01:00
midibuf.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
pcm.c ALSA: line6: Use managed buffer allocation 2019-12-11 07:25:23 +01:00
pcm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
playback.c ALSA: line6: Perform sanity check for each URB creation 2020-07-10 16:29:18 +02:00
playback.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
pod.c ALSA: line6: Fix racy initialization of LINE6 MIDI 2021-05-26 12:06:51 +02:00
podhd.c sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv() 2020-09-25 16:33:59 +02:00
toneport.c sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv() 2020-09-25 16:33:59 +02:00
variax.c ALSA: line6: Fix racy initialization of LINE6 MIDI 2021-05-26 12:06:51 +02:00