ALSA: control: Fix UAF in snd_ctl_elem_add() on card disconnect
- CVE-2026-142800
- GHSA-h8fr-fj52-5c8g
- EUVD-2026-142301
Description
Show the whole descriptionHide the whole description
In the Linux kernel, the following vulnerability has been resolved: ALSA: control: Fix UAF in snd_ctl_elem_add() on card disconnect A use-after-free can be triggered via SNDRV_CTL_IOCTL_ELEM_ADD when a USB audio card is disconnected while an ELEM_ADD ioctl is in flight. The reproducer parks the ioctl thread inside copy_from_user() using userfaultfd, then tears down the USB device. Unlike every other ALSA control _user handler (ELEM_INFO, ELEM_READ, ELEM_WRITE, TLV_*), snd_ctl_elem_add_user() never calls snd_power_ref_and_wait(), so the parked thread holds no power reference. snd_card_disconnect() therefore cannot observe it via snd_power_sync_ref() and proceeds unimpeded: 1. card->shutdown is set to 1 2. device_del(&card->card_dev) drops the kobject reference on the parent USB interface device (card->dev = &intf->dev) 3. The USB core drops its own reference and calls device_release(), freeing the struct usb_interface, including the embedded struct device that card->dev points to When the userfaultfd is resolved and the thread resumes, snd_ctl_elem_add() acquires controls_rwsem without checking card->shutdown and calls __snd_ctl_add_replace(). Because the reproducer pre-registered the same control, the CTL_ADD_EXCLUSIVE path calls dev_err(card->dev, ...) on the freed USB interface: KASAN: slab-use-after-free Read in __dev_printk Add a card->shutdown guard immediately after acquiring controls_rwsem in snd_ctl_elem_add(). At that point card->shutdown is guaranteed to be stable: snd_card_disconnect() 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 controls_rwsem-less shutdown=1 store (which happened earlier, outside the lock) from racing with dev_err().
Text from the CVE.org record.
Recommendation
Linux
- If you run a version before 7.3.2update to 7.3.2 or later
- If you run a version before 6.18.61update to 6.18.61 or later
- If you run a version before 6.12.117update to 6.12.117 or later
- If you run a version before 6.6.163update to 6.6.163 or later
- If you run a version before 6.1.193update to 6.1.193 or later
- If you run a version before 5.15.226update to 5.15.226 or later
- If you run a version before 5.10.275update to 5.10.275 or later
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 versions Fixed in before 7.3.2 7.3.2 before 6.18.61 6.18.61 before 6.12.117 6.12.117 before 6.6.163 6.6.163 before 6.1.193 6.1.193 before 5.15.226 5.15.226 before 5.10.275 5.10.275 from 5.10.275 up to 5.10.*: not affected none stated and 7 more
Product versions from the CVE.org record.
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.