CVE-2026-142800: ALSA: control: Fix UAF in snd_ctl_elem_add() on card disconnect
In the Linux kernel, the following vulnerability has been resolved:
ALSA: control: Fix UAF in sndctlelemadd() on card disconnect
A use-after-free can be triggered via SNDRVCTLIOCTLELEMADD when a USB audio card is disconnected while an ELEMADD ioctl is in flight.
The reproducer parks the ioctl thread inside copyfromuser() using userfaultfd, then tears down the USB device. Unlike every other ALSA control user handler (ELEMINFO, ELEMREAD, ELEMWRITE, TLV), sndctlelemadduser() never calls sndpowerrefandwait(), so the parked thread holds no power reference. sndcarddisconnect() therefore cannot observe it via sndpowersyncref() and proceeds unimpeded:
1. card->shutdown is set to 1 2. devicedel(&card->carddev) drops the kobject reference on the parent USB interface device (card->dev = &intf->dev) 3. The USB core drops its own reference and calls devicerelease(), freeing the struct usbinterface, including the embedded struct device that card->dev points to
When the userfaultfd is resolved and the thread resumes, sndctlelemadd() acquires controlsrwsem without checking card->shutdown and calls sndctladdreplace(). Because the reproducer pre-registered the same control, the CTLADDEXCLUSIVE path calls deverr(card->dev, ...) on the freed USB interface:
KASAN: slab-use-after-free Read in devprintk
Add a card->shutdown guard immediately after acquiring controlsrwsem in sndctlelemadd(). At that point card->shutdown is guaranteed to be stable: sndcarddisconnect() sets it before freeing the parent device, and it never transitions back to 0. A thread that acquired the lock before disconnect sees shutdown=0 and holds the write lock through the rest of the operation, preventing concurrent disconnect from proceeding past its own controlsrwsem-less shutdown=1 store (which happened earlier, outside the lock) from racing with deverr().
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.61 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.2 - Compensating control
In snd_ctl_elem_add(), add a card->shutdown guard immediately after acquiring controls_rwsem.
Event History
Frequently Asked Questions
What conditions are required to trigger this issue?
A SNDRV_CTL_IOCTL_ELEM_ADD request must be in flight while a USB audio card is disconnected. The described reproducer stalls the ioctl in copy_from_user() with userfaultfd, disconnects the USB device, and then allows the ioctl to resume.
Which systems are exposed?
Systems using the Linux kernel with a USB audio card can be affected when an ALSA control ELEM_ADD ioctl races with card disconnection. The issue specifically involves snd_ctl_elem_add_user() lacking the power-reference handling used by other ALSA control user handlers.