summaryrefslogtreecommitdiff
path: root/Documentation/console/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorMehul Rao <mehulrao@gmail.com>2026-03-05 14:35:07 -0500
committerTakashi Iwai <tiwai@suse.de>2026-03-09 09:56:09 +0100
commit9b1dbd69ba6f8f8c69bc7b77c2ce3b9c6ed05ba6 (patch)
tree6d4ec1f4d9d960b5b747403e2cfedaa224ae8ba7 /Documentation/console/git@git.tavy.me:linux.git
parent56fbbe096a89ff4b52af78a21a4afd9d94bdcc80 (diff)
ALSA: pcm: fix use-after-free on linked stream runtime in snd_pcm_drain()
In the drain loop, the local variable 'runtime' is reassigned to a linked stream's runtime (runtime = s->runtime at line 2157). After releasing the stream lock at line 2169, the code accesses runtime->no_period_wakeup, runtime->rate, and runtime->buffer_size (lines 2170-2178) — all referencing the linked stream's runtime without any lock or refcount protecting its lifetime. A concurrent close() on the linked stream's fd triggers snd_pcm_release_substream() → snd_pcm_drop() → pcm_release_private() → snd_pcm_unlink() → snd_pcm_detach_substream() → kfree(runtime). No synchronization prevents kfree(runtime) from completing while the drain path dereferences the stale pointer. Fix by caching the needed runtime fields (no_period_wakeup, rate, buffer_size) into local variables while still holding the stream lock, and using the cached values after the lock is released. Fixes: f2b3614cefb6 ("ALSA: PCM - Don't check DMA time-out too shortly") Cc: stable@vger.kernel.org Signed-off-by: Mehul Rao <mehulrao@gmail.com> Link: https://patch.msgid.link/20260305193508.311096-1-mehulrao@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'Documentation/console/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions