ALSA: pcm: wake linked drain waiters on unlink
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f57f3df03a8e6010e321fa0258d3e054713c3cb7 · < 2940cc3cf43c72126b74ee6376314c195382023a| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ALSA: pcm: wake linked drain waiters on unlink
snd_pcm_drain() on a linked stream parks an on-stack wait entry on the drained peer's runtime->sleep, and after schedule_timeout() removes it only if that peer is still found in the caller's group. If group membership changes during the wait and the sleep ends by signal or timeout (so autoremove_wake_function() does not run), finish_wait() is skipped and snd_pcm_drain() returns with the entry still queued on that stream's sleep list; a later wake_up() then walks a freed stack frame. This is reachable by unlinking either the drained or the draining stream.
Unlike the close path (snd_pcm_drop() -> snd_pcm_post_stop()), snd_pcm_unlink() never wakes the sleep queues. Wake every group member under the group lock before the membership change, so a linked drainer is released and drops its entry while the streams are still grouped.
The window was opened when snd_pcm_link_rwsem stopped being held across the wait and the removal became conditional on group membership (see Fixes). The later switch to finish_wait() kept that conditional removal, so the signal/timeout case remained.
From the CVE record · Linux
The Linux kernel’s ALSA PCM code can leave a wait entry pointing to a freed stack frame when a linked stream is unlinked during snd_pcm_drain() and the wait ends by signal or timeout. A later wake-up can access that freed frame. The input does not specify an attack path, authentication requirements, or user-interaction requirements.
Engineers running Linux kernels with ALSA PCM should check whether their kernel includes the fix; affected versions are not specified.