cvelo
P2 · HighCVSS 7.8EPSS 0.2%

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

  • CVE-2026-139361
  • GHSA-g426-vxx7-6v22
  • EUVD-2026-139066

Description

Show the whole 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.

Text from the CVE.org record.

Recommendation

  • Linux

    • If you run a version from 6.19.9 to before 6.20update to 6.20 or laterMinor version change: check the release notes
    • If you run 6.18.xupdate to 6.18.65 or laterPatch update: breaking changes are unlikely
    • If you run 6.12.xupdate to 6.12.119 or laterPatch update: breaking changes are unlikely
    • If you run 6.6.xupdate to 6.6.163 or laterPatch update: breaking changes are unlikely
    • If you run 6.1.xupdate to 6.1.193 or laterPatch update: breaking changes are unlikely
    • If you run 5.15.xupdate to 5.15.226 or laterPatch update: breaking changes are unlikely
    • If you run a version from 5.10.253 to before 5.11update to 5.11 or laterMinor version change: check the release notes

    Some affected versions have no stated fix.

Taken from the version ranges of the CVE.org record. Check the vendor advisory: nothing is said about versions the ranges do not list. Breaking-change risk is read from the version numbers only.

Affected

  • Linux

    Affected versionsFixed in
    from 6.19.9 to before 6.206.20
    from 6.18.19 to before 6.18.656.18.65
    from 6.12.78 to before 6.12.1196.12.119
    from 6.6.130 to before 6.6.1636.6.163
    from 6.1.167 to before 6.1.1936.1.193
    from 5.15.220 to before 5.15.2265.15.226
    from 5.10.253 to before 5.115.11
    7.0none stated

    and 8 more

Product versions from the CVE.org record.

Timeline

  1. Published

Related news

No article from the followed outlets names this vulnerability.