linux/sound/usb
Takashi Iwai 0665886ad1 ALSA: usb-audio: Clear MIDI port active flag after draining
When a rawmidi output stream is closed, it calls the drain at first,
then does trigger-off only when the drain returns -ERESTARTSYS as a
fallback.  It implies that each driver should turn off the stream
properly after the drain.  Meanwhile, USB-audio MIDI interface didn't
change the port->active flag after the drain.  This may leave the
output work picking up the port that is closed right now, which
eventually leads to a use-after-free for the already released rawmidi
object.

This patch fixes the bug by properly clearing the port->active flag
after the output drain.

Reported-by: syzbot+70e777a39907d6d5fd0a@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/00000000000011555605dceaff03@google.com
Link: https://lore.kernel.org/r/20220420130247.22062-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-04-20 15:13:45 +02:00
..
6fire
bcd2000
caiaq
hiface
line6
misc
usx2y
card.c
card.h
clock.c
clock.h
endpoint.c
endpoint.h
format.c
format.h
helper.c
helper.h
implicit.c
implicit.h
Kconfig
Makefile
media.c
media.h
midi.c ALSA: usb-audio: Clear MIDI port active flag after draining 2022-04-20 15:13:45 +02:00
midi.h
mixer.c
mixer.h
mixer_maps.c ALSA: usb-audio: add mapping for MSI MAG X570S Torpedo MAX. 2022-04-19 09:02:33 +02:00
mixer_quirks.c ALSA: usb-audio: Add mute TLV for playback volumes on RODE NT-USB 2022-03-12 08:50:43 +01:00
mixer_quirks.h
mixer_s1810c.c
mixer_s1810c.h
mixer_scarlett.c
mixer_scarlett.h
mixer_scarlett_gen2.c
mixer_scarlett_gen2.h
mixer_us16x08.c
mixer_us16x08.h
pcm.c ALSA: usb-audio: Limit max buffer and period sizes per time 2022-04-13 09:10:56 +02:00
pcm.h
power.c
power.h
proc.c
proc.h
quirks-table.h
quirks.c
quirks.h
stream.c
stream.h
usbaudio.h ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant 2022-04-05 18:22:13 +02:00
validate.c