CVE-2026-138850
published high CVSS 3.1 · 7.8misc: fastrpc: fix double-free in fastrpc_map_attach() error path
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 3a05f8579fc0a3d04e1e9de766630a722d7ca6b6 · 334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 0bde6e438035a3bb80ba4f735b8c61a68001f8aa · 334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 5ba8a7ebd96d2e271905348e8aed19fe726e3648 · 334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 51731e49fe9a7359d4dd17e77189a21b29115233 · 334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 09fa66ec1b4896ab841da085ca58b6433f28f07f · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux6.2 (affected) · 0 to < 6.2 (unaffected · semver) · 6.6.163 through 6.6.* (unaffected · semver) · 6.12.118 through 6.12.* (unaffected · semver) · 6.18.64 through 6.18.* (unaffected · semver) · 7.3.4 through 7.3.* (unaffected · semver) · 7.4-rc1 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
Description
In the Linux kernel, the following vulnerability has been resolved: misc: fastrpc: fix double-free in fastrpc_map_attach() error path map->table is assigned right after dma_buf_map_attachment_unlocked() succeeds. The two failure checks that follow, the len > map->size test and, where subsystem VMIDs are configured, a failed qcom_scm_assign_mem(), jump to map_err with map->table already set. map_err manually calls dma_buf_detach() and dma_buf_put() and then falls through to fastrpc_map_put(). Since that change the error path tail is fastrpc_map_put() -> fastrpc_free_map(), and fastrpc_free_map() already unmaps, detaches and puts the dma-buf whenever map->table is set. The two operations therefore run twice: the second dma_buf_put() drops an extra reference on map->buf, and dma_buf_unmap_attachment_unlocked() dereferences the map->attach already freed by the manual dma_buf_detach(). kref_init() sets the refcount to 1 with no intervening get, so the final fastrpc_map_put() frees the map synchronously and the redundant cleanup is deterministic. The len > map->size branch is reachable by an unprivileged process via FASTRPC_IOCTL_MEM_MAP with an fd whose dma-buf is smaller than the requested length, before any DSP invocation. Route both map->table-is-set failure branches to get_err instead of map_err, so fastrpc_free_map() is the single owner of the unmap/detach/put sequence. map_err is retained for the dma_buf_map_attachment_unlocked() failure, which is reached with map->table still NULL and an attachment that fastrpc_free_map() will not clean up, so its dma_buf_detach()/dma_buf_put() must still run manually.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - The faulty map_err path in fastrpc_map_attach() is reached only through ioctl(FASTRPC_IOCTL_MEM_MAP) on the local /dev/fastrpc-* misc device, via fastrpc_req_mem_map() and fastrpc_map_create(). The bad length comes from the local caller's struct fastrpc_mem_map, not from the DSP or a network peer. AC:L - Deterministic: the attacker gets a small dma-buf from FASTRPC_IOCTL_ALLOC_DMA_BUFF, then passes MEM_MAP a req.length larger than it. That makes len > map->size true with map->table set, and kref_init leaves the refcount at 1, so fastrpc_map_put() frees the map synchronously and repeats the unmap/detach/put on every call. No race and no DSP response needed. PR:L - Opening the non-secure fastrpc node is the only gate. is_session_rejected() explicitly provides for 'untrusted applications' on that node, and fastrpc_req_mem_map() performs no capability or secure-device check before fastrpc_map_create(), so an ordinary unprivileged user with access to the node can trigger it. UI:N - The attacker drives the whole sequence (open, ALLOC_DMA_BUFF, MEM_MAP) with their own syscalls on a dma-buf they created themselves; no other user, mount or administrator action is involved. S:U - The corruption hits host-kernel objects (dma_buf_attachment, fastrpc_dma_buf_attachment, the dma-buf struct file), and the result is host kernel compromise in the same security authority. The secure-map/hypervisor branch is not reachable on this path. C:H - fastrpc_free_map() calls dma_buf_unmap_attachment_unlocked() on a map->attach and sg_table already freed by the manual dma_buf_detach(), then makes a second dma_buf_put(). The fput count underflows and frees the dma-buf struct file while the user's fd still refers to it: a reclaimable file UAF that gives kernel read primitives. I:H - The second dma_buf_detach() calls kfree() again on the attachment and on fastrpc_dma_buf_attachment (both in generic kmalloc caches), and the extra fput leaves a dangling dma-buf fd. Both are double-free/UAF write primitives that can be groomed into arbitrary kernel write and privilege escalation. A:H - Each MEM_MAP call with an oversized length repeats the use-after-free in dma_buf_unmap_attachment()/fastrpc_unmap_dma_buf() and the list_del() on the already-poisoned attach->node, which oopses or triggers SLUB double-free/list-corruption BUGs and can panic the kernel at will.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 3a05f8579fc0a3d04e1e9de766630a722d7ca6b6 (affected · git)334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 0bde6e438035a3bb80ba4f735b8c61a68001f8aa (affected · git)334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 5ba8a7ebd96d2e271905348e8aed19fe726e3648 (affected · git)334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 51731e49fe9a7359d4dd17e77189a21b29115233 (affected · git)334f1a1cbe032d85fd58e771629e3a3b373b96d5 to < 09fa66ec1b4896ab841da085ca58b6433f28f07f (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 6.2 (affected)0 to < 6.2 (unaffected · semver)6.6.163 through 6.6.* (unaffected · semver)6.12.118 through 6.12.* (unaffected · semver)6.18.64 through 6.18.* (unaffected · semver)7.3.4 through 7.3.* (unaffected · semver)7.4-rc1 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
5- https://git.kernel.org/stable/c/09fa66ec1b4896ab841da085ca58b6433f28f07f
- https://git.kernel.org/stable/c/0bde6e438035a3bb80ba4f735b8c61a68001f8aa
- https://git.kernel.org/stable/c/3a05f8579fc0a3d04e1e9de766630a722d7ca6b6
- https://git.kernel.org/stable/c/51731e49fe9a7359d4dd17e77189a21b29115233
- https://git.kernel.org/stable/c/5ba8a7ebd96d2e271905348e8aed19fe726e3648
Provider assertions
1Linux · cna
misc: fastrpc: fix double-free in fastrpc_map_attach() error path
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 5e894f8daa2f0a6c67df7ce55d0193e34eec89dc77eb60e1a4bda7e165f87545
- Ingested
- 01 Dec 2026, 05:47:22 UTC
- Source record
- Official CVE record