mirror-linux/sound/drivers
Cássio Gabriel e5c33cdc6f ALSA: aloop: Fix peer runtime UAF during format-change stop
loopback_check_format() may stop the capture side when playback starts
with parameters that no longer match a running capture stream. Commit
826af7fa62 ("ALSA: aloop: Fix racy access at PCM trigger") moved
the peer lookup under cable->lock, but the actual snd_pcm_stop() still
runs after dropping that lock.

A concurrent close can clear the capture entry from cable->streams[] and
detach or free its runtime while the playback trigger path still holds a
stale peer substream pointer.

Keep a per-cable count of in-flight peer stops before dropping
cable->lock, and make free_cable() wait for those stops before
detaching the runtime. This preserves the existing behavior while
making the peer runtime lifetime explicit.

Reported-by: syzbot+8fa95c41eafbc9d2ff6f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8fa95c41eafbc9d2ff6f
Fixes: 597603d615 ("ALSA: introduce the snd-aloop module for the PCM loopback")
Cc: stable@vger.kernel.org
Suggested-by: Takashi Iwai <tiwai@suse.com>
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260424-alsa-aloop-peer-stop-uaf-v2-1-94e68101db8a@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-04-27 13:50:37 +02:00
..
mpu401 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
opl3 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
opl4 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pcsp ALSA: pcsp: Use safer strscpy() instead of strcpy() 2025-07-11 09:51:09 +02:00
vx ALSA: vx: use correct function name in kernel-doc comment 2026-04-17 09:48:20 +02:00
Kconfig ALSA: Make SND_PCMTEST depend on DEBUG_FS 2023-08-18 09:10:22 +02:00
Makefile ALSA: drivers: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:57 +02:00
aloop.c ALSA: aloop: Fix peer runtime UAF during format-change stop 2026-04-27 13:50:37 +02:00
dummy.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mtpav.c ALSA: mtpav: Use guard() for spin locks 2025-09-01 13:53:35 +02:00
mts64.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pcmtest.c Revert "ALSA: pcmtest: fix reference leak on failed device registration" 2026-04-23 10:57:53 +02:00
portman2x4.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
serial-generic.c ALSA: serial-generic: remove shared static buffer 2025-09-15 12:33:53 +02:00
serial-u16550.c ALSA: serial-u16550: Use guard() for spin locks 2025-09-01 13:53:35 +02:00
virmidi.c ALSA: virmidi: Use safer strscpy() instead of strcpy() 2025-07-11 09:51:09 +02:00