linux-stable/sound/core
Takashi Iwai fd49da9365 ALSA: seq: Fix a potential UAF by wrong private_free call order
commit 1f8763c59c upstream.

John Keeping reported and posted a patch for a potential UAF in
rawmidi sequencer destruction: the snd_rawmidi_dev_seq_free() may be
called after the associated rawmidi object got already freed.
After a deeper look, it turned out that the bug is rather the
incorrect private_free call order for a snd_seq_device.  The
snd_seq_device private_free gets called at the release callback of the
sequencer device object, while this was rather expected to be executed
at the snd_device call chains that runs at the beginning of the whole
card-free procedure.  It's been broken since the rewrite of
sequencer-device binding (although it hasn't surfaced because the
sequencer device release happens usually right along with the card
device release).

This patch corrects the private_free call to be done in the right
place, at snd_seq_device_dev_free().

Fixes: 7c37ae5c62 ("ALSA: seq: Rewrite sequencer device binding with standard bus")
Reported-and-tested-by: John Keeping <john@metanate.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210930114114.8645-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-20 10:42:02 +02:00
..
oss ALSA: pcm: oss: Fix a few more UBSAN fixes 2020-12-29 13:47:05 +01:00
seq ALSA: seq: Fix racy deletion of subscriber 2021-08-15 13:03:28 +02:00
compress_offload.c ALSA: compress: fix partial_drain completion state 2020-07-22 09:22:17 +02:00
control.c ALSA: ctl: fix error path at adding user-defined element set 2020-11-24 13:05:51 +01:00
control_compat.c ALSA: control: fix a redundant-copy issue 2018-05-22 18:53:56 +02:00
ctljack.c
device.c
hrtimer.c
hwdep.c ALSA: hwdep: fix a left shifting 1 by 31 UB bug 2020-06-03 08:18:01 +02:00
hwdep_compat.c
info.c ALSA: info: Drop WARN_ON() from buffer NULL sanity check 2020-07-29 07:42:52 +02:00
info_oss.c
init.c ALSA: core: remove redundant spin_lock pair in snd_card_disconnect 2021-05-22 10:57:32 +02:00
isadma.c
jack.c
Kconfig
Makefile
memalloc.c ALSA: memalloc: Don't exceed over the requested size 2018-08-22 07:46:10 +02:00
memory.c
misc.c
pcm.c ALSA: pcm: Fix potential Spectre v1 vulnerability 2019-01-09 17:14:46 +01:00
pcm_compat.c ALSA: pcm: Check PCM state at xfern compat ioctl 2018-05-09 09:51:49 +02:00
pcm_dmaengine.c
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c ALSA: pcm: fix divide error in snd_pcm_lib_ioctl 2021-09-22 11:45:15 +02:00
pcm_local.h
pcm_memory.c
pcm_misc.c
pcm_native.c ALSA: pcm: Clear the full allocated memory at hw_params 2021-01-09 13:37:39 +01:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
rawmidi.c ALSA: rawmidi: Fix racy buffer resize under concurrent accesses 2020-05-20 08:17:14 +02:00
rawmidi_compat.c
seq_device.c ALSA: seq: Fix a potential UAF by wrong private_free call order 2021-10-20 10:42:02 +02:00
sgbuf.c
sound.c
sound_oss.c
timer.c ALSA: timer: Fix master timer notification 2021-06-10 12:43:51 +02:00
timer_compat.c
vmaster.c ALSA: vmaster: Propagate slave error 2018-05-30 07:52:35 +02:00