linux-stable/sound/usb
Takashi Iwai cba852b35c ALSA: usb-audio: Clear MIDI port active flag after draining
commit 0665886ad1 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-27 13:15:29 +02:00
..
6fire ALSA: 6fire: fix control and bulk message timeouts 2021-11-26 11:40:21 +01:00
bcd2000
caiaq
hiface
line6 ALSA: line6: fix control and interrupt message timeouts 2021-11-26 11:40:21 +01:00
misc ALSA: ua101: fix division by zero at probe 2021-11-26 11:40:21 +01:00
usx2y ALSA: usx2y: Fix potential NULL dereference 2020-05-02 17:24:22 +02:00
card.c ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls 2021-05-22 10:57:32 +02:00
card.h ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109 2020-08-21 09:48:15 +02:00
clock.c ALSA: usb-audio: Disable sample read check if firmware doesn't give back 2020-12-29 13:47:05 +01:00
clock.h
debug.h
endpoint.c Revert "ALSA: usb-audio: Improve frames size computation" 2020-07-09 09:36:32 +02:00
endpoint.h Revert "ALSA: usb-audio: Improve frames size computation" 2020-07-09 09:36:32 +02:00
format.c ALSA: usb-audio: fix rate on Ozone Z90 USB headset 2021-07-20 16:17:27 +02:00
format.h
helper.c
helper.h
Kconfig
Makefile
midi.c ALSA: usb-audio: Clear MIDI port active flag after draining 2022-04-27 13:15:29 +02:00
midi.h
mixer.c ALSA: usb-audio: Fix OOB access of mixer element list 2020-06-30 15:38:02 -04:00
mixer.h ALSA: usb-audio: Fix OOB access of mixer element list 2020-06-30 15:38:02 -04:00
mixer_maps.c ALSA: usb-audio: Add mixer workaround for TRX40 and co 2020-04-24 08:00:33 +02:00
mixer_quirks.c ALSA: usb-audio: Add mute TLV for playback volumes on RODE NT-USB 2022-03-28 08:22:27 +02:00
mixer_quirks.h
mixer_scarlett.c ALSA: usb-audio: Clean up mixer element list traverse 2020-06-30 15:38:02 -04:00
mixer_scarlett.h
mixer_us16x08.c ALSA: usb-audio: US16x08: fix value count for level meters 2020-12-08 10:17:34 +01:00
mixer_us16x08.h
pcm.c ALSA: usb-audio: fix sync-ep altsetting sanity check 2021-01-09 13:37:36 +01:00
pcm.h
power.h
proc.c
proc.h
quirks-table.h ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headset 2021-10-27 09:51:40 +02:00
quirks.c ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls 2021-05-22 10:57:32 +02:00
quirks.h
stream.c ALSA: usb-audio: Fix control 'access overflow' errors from chmap 2020-12-29 13:46:46 +01:00
stream.h
usbaudio.h ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls 2021-05-22 10:57:32 +02:00