CVE-2026-139361

ALSA: pcm: Add refcount for races between drain and unlink

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

ALSA: pcm: Add refcount for races between drain and unlink

We added a workaround for the case where a linked substream gets
unlinked during the drain operation by another substream of the same
linked group in the commit 9b1dbd69ba6f ("ALSA: pcm: fix
use-after-free on linked stream runtime in snd_pcm_drain()").
There, we just cached the parameters of the draining substream for
avoiding UAF.

Then, we check the draining substream (to_check) again in the loop and
remove it from the queue only when it's still present. It means,
however, that the wait queue entry won't be removed if the substream
went out of the link beforehand, hence a stale wq entry remains.
Later on, this can be woken up, and this may hit a UAF, too.
The problem surfaced more due to the recent change to call
snd_pcm_unlink() earlier.

For properly handling both cases above, in this patch, we introduce a
refcount to the snd_pcm_runtime that indicates the substream is being
accessed / used, then at snd_pcm_release_substream(), it's synced
before the actual resource release via snd_refcount_sync(). This
guarantees that the accessors are finished, and safe to release
memories. Along with the introduction of a refcount, the comments and
the code changes by the former fix were partially reverted as they
don't fit with the updated code flow any longer.

Last but not least, the setup of wait queue entry and
prepare_to_wait() call are moved before the group unref. With this
change, we can avoid the race between the enqueue and the wakeup, too.

Analysis

AI-generated

Technical impact

A race condition exists between the drain and unlink operations on linked PCM streams. When a substream is unlinked while another substream performs a drain, a stale wait‑queue entry may remain. This can result in a use‑after‑free in the kernel’s ALSA runtime, potentially corrupting memory, causing a system crash, or, in a privileged context, allowing elevation of privilege. The vulnerability is confined to the kernel level and requires local access to the affected PCM streams, so it is not remotely exploitable without additional compromise.

Affected Systems

The issue affects Linux kernel implementations, specifically the ALSA (Advanced Linux Sound Architecture) PCM subsystem. The patch addressing the race was added to the mainline kernel, so any kernel build that predates this change is potentially vulnerable. Specific version numbers are not listed, but the fix is part of the 2026 kernel series.

Risk and Exploitability

The CVSS score is not provided and EPSS is unavailable, but the lack of a publicly listed KEV entry does not diminish the severity; a kernel crash can lead to a denial of service or privilege escalation if the UAF is exercised. The attack vector is local kernel exploitation during audio stream manipulation. Since the problem affects the kernel’s core sound subsystem, the potential impact extends to any process running with kernel privileges. Applying the updated kernel removes the race and protects against the associated memory corruption.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to a release that includes the ALSA refcount fix (the patch is part of the 2026 series).
  • Reboot the system (or reload the ALSA modules) so that the kernel’s sound subsystem is reset fresh.
  • If an immediate kernel upgrade is not feasible, blacklist or unload the ALSA modules (snd_pcm, snd_hwdep, etc.) to prevent the vulnerable code path from being used, accepting temporary loss of audio functionality.

Generated by OpenCVE AI on November 30, 2026 at 22:12 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-362
CWE-416
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: ALSA: pcm: Add refcount for races between drain and unlink We added a workaround for the case where a linked substream gets unlinked during the drain operation by another substream of the same linked group in the commit 9b1dbd69ba6f ("ALSA: pcm: fix use-after-free on linked stream runtime in snd_pcm_drain()"). There, we just cached the parameters of the draining substream for avoiding UAF. Then, we check the draining substream (to_check) again in the loop and remove it from the queue only when it's still present. It means, however, that the wait queue entry won't be removed if the substream went out of the link beforehand, hence a stale wq entry remains. Later on, this can be woken up, and this may hit a UAF, too. The problem surfaced more due to the recent change to call snd_pcm_unlink() earlier. For properly handling both cases above, in this patch, we introduce a refcount to the snd_pcm_runtime that indicates the substream is being accessed / used, then at snd_pcm_release_substream(), it's synced before the actual resource release via snd_refcount_sync(). This guarantees that the accessors are finished, and safe to release memories. Along with the introduction of a refcount, the comments and the code changes by the former fix were partially reverted as they don't fit with the updated code flow any longer. Last but not least, the setup of wait queue entry and prepare_to_wait() call are moved before the group unref. With this change, we can avoid the race between the enqueue and the wakeup, too.
Title ALSA: pcm: Add refcount for races between drain and unlink
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-362

    Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

  • CWE-416

    Use After Free

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:34 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM