CVE-2026-143370: ALSA: memalloc: Free the new pages when WC DMA mapping fails
In the Linux kernel, the following vulnerability has been resolved:
ALSA: memalloc: Free the new pages when WC DMA mapping fails
snddmawcalloc() keeps the newly allocated pages in a local variable, and snddmaallocdirpages() stores them in dmab->area only after ->alloc() returns. If dmamapsingle() fails, the error path passes dmab->area to dofreepages() instead, and that is still NULL at this point for the usual callers.
The pages are then leaked with their write-combining attribute still set, setmemorywb() warns about the zero address, and for buffers larger than a page freepagesexact() goes on to free the struct pages of the bogus addresses 4096, 8192 and so on. With CONFIGDEBUGVM that hits the VMBUGON() in freepages():
kernel BUG at mm/pagealloc.c:5600! RIP: 0010:freepagesexact+0xcb/0xd0 Call Trace: snddmawcalloc+0x14f/0x160 [sndpcm] snddmaallocdirpages+0x4f/0x80 [sndpcm]
This was reproduced on an x86 guest without swiotlb by allocating SNDRVDMATYPEDEVWC buffers for a device with a 24-bit streaming DMA mask, so that dmamapsingle() fails.
Free the pages that were just allocated.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.120 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.66 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.7 - Compensating control
In snd_dma_wc_alloc(), free the newly allocated pages when dma_map_single() fails.
Event History
Frequently Asked Questions
What conditions are needed to trigger this issue?
A caller must allocate an ALSA SNDRV_DMA_TYPE_DEV_WC buffer for a device whose DMA mapping fails in snd_dma_wc_alloc(). The reported reproduction used an x86 guest without swiotlb and a device with a 24-bit streaming DMA mask.
What is the practical impact when the DMA mapping fails?
The newly allocated pages can be leaked while retaining their write-combining attribute. The cleanup path may also call set_memory_wb() on a zero address and, for buffers larger than one page, attempt to free bogus addresses; with CONFIG_DEBUG_VM this can trigger a kernel BUG.
How can an administrator identify a possible occurrence?
Look for DMA mapping failures during ALSA write-combining DMA buffer allocation, followed by warnings related to set_memory_wb() and, on CONFIG_DEBUG_VM kernels, a VM_BUG_ON() in free_pages() with a stack trace involving free_pages_exact, snd_dma_wc_alloc, and snd_dma_alloc_dir_pages.