CVE-2026-53161: misc: fastrpc: fix use-after-free of fastrpc_user in workqueue context
In the Linux kernel, the following vulnerability has been resolved:
misc: fastrpc: fix use-after-free of fastrpcuser in workqueue context
There is a race between fastrpcdevicerelease() and the workqueue that processes DSP responses. When the user closes the file descriptor, fastrpcdevicerelease() frees the fastrpcuser structure. Concurrently, an in-flight DSP invocation can complete and fastrpcrpmsgcallback() schedules context cleanup via schedulework(&ctx->putwork). If the workqueue runs fastrpccontextfree() in parallel with or after fastrpcdevicerelease() has freed the user structure, it dereferences the freed fastrpcuser. Depending on the state of the context at the time of the race, any one of the following accesses can be hit:
1. fastrpcbuffree() calls fastrpcipatodmaaddr(buf->fl->cctx, ...) to strip the SID bits from the stored IOVA before passing the physical address to dmafreecoherent().
2. fastrpcfreemap() reads map->fl->cctx->vmperms[0].vmid to reconstruct the source permission bitmask needed for the qcomscmassignmem() call that returns memory from the DSP VM back to HLOS.
3. fastrpcfreemap() acquires map->fl->lock to safely remove the map node from the fl->maps list.
The resulting use-after-free manifests as:
pc : fastrpcbuffree+0x38/0x80 [fastrpc] lr : fastrpccontextfree+0xa8/0x1b0 [fastrpc] fastrpccontextfree+0xa8/0x1b0 [fastrpc] fastrpccontextputwq+0x78/0xa0 [fastrpc] processonework+0x180/0x450 workerthread+0x26c/0x388
Add kref-based reference counting to fastrpcuser. Have each invoke context take a reference on the user at allocation time and release it when the context is freed. Release the initial reference in fastrpcdevicerelease() at file close. Move the teardown of the user structure — freeing pending contexts, maps, mmaps, and the channel context reference — into the kref release callback fastrpcuserfree(), so that it runs only when the last reference is dropped, regardless of whether that happens at device close or after the final in-flight context completes.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 6.6.143.1-1 - Configuration
Apply the kernel fix for "misc: fastrpc: fix use-after-free of fastrpc_user in workqueue context" by adding kref-based reference counting to fastrpc_user, moving the teardown of the user into the kref release callback (fastrpc_user_free()), and ensuring the teardown runs only when the last reference is dropped so fastrpc_device_release() does not free fastrpc_user while workqueue/in-flight callbacks may still dereference it.
Linux kernel (fastrpc) misc: fastrpc user teardown/workqueue teardown = Use kref-based reference counting for fastrpc_user; release initial reference in the kref release callback
Event History
Frequently Asked Questions
What is the severity of CVE-2026-53161?
CVE-2026-53161 has a risk score of 47.
What type of vulnerability is CVE-2026-53161?
CVE-2026-53161 is classified as a Use After Free vulnerability.
How does CVE-2026-53161 occur in the Linux kernel?
CVE-2026-53161 occurs due to a race condition between fastrpc_device_release() and a workqueue processing DSP responses.
How can I mitigate CVE-2026-53161 in my system?
To mitigate CVE-2026-53161, ensure that you are using the patched version of the Linux kernel that resolves this vulnerability.
What components are affected by CVE-2026-53161?
CVE-2026-53161 specifically affects the fastrpc component within the Linux kernel.