{"id":"CVE-2026-138850","summary":"misc: fastrpc: fix double-free in fastrpc_map_attach() error path","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmisc: fastrpc: fix double-free in fastrpc_map_attach() error path\n\nmap-\u003etable is assigned right after dma_buf_map_attachment_unlocked()\nsucceeds. The two failure checks that follow, the len \u003e map-\u003esize test\nand, where subsystem VMIDs are configured, a failed qcom_scm_assign_mem(),\njump to map_err with map-\u003etable already set.\n\nmap_err manually calls dma_buf_detach() and dma_buf_put() and then falls\nthrough to fastrpc_map_put(). Since that change the error path tail is\nfastrpc_map_put() -\u003e fastrpc_free_map(), and fastrpc_free_map() already\nunmaps, detaches and puts the dma-buf whenever map-\u003etable is set.\nThe two operations therefore run twice: the second dma_buf_put() drops an\nextra reference on map-\u003ebuf, and dma_buf_unmap_attachment_unlocked()\ndereferences the map-\u003eattach already freed by the manual dma_buf_detach().\nkref_init() sets the refcount to 1 with no intervening get, so the final\nfastrpc_map_put() frees the map synchronously and the redundant cleanup is\ndeterministic.\n\nThe len \u003e map-\u003esize branch is reachable by an unprivileged process via\nFASTRPC_IOCTL_MEM_MAP with an fd whose dma-buf is smaller than the\nrequested length, before any DSP invocation.\n\nRoute both map-\u003etable-is-set failure branches to get_err instead of\nmap_err, so fastrpc_free_map() is the single owner of the\nunmap/detach/put sequence. map_err is retained for the\ndma_buf_map_attachment_unlocked() failure, which is reached with\nmap-\u003etable still NULL and an attachment that fastrpc_free_map() will not\nclean up, so its dma_buf_detach()/dma_buf_put() must still run manually.","modified":"2026-11-30T15:01:09.544403669Z","published":"2026-11-30T13:25:33.892Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138850.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/09fa66ec1b4896ab841da085ca58b6433f28f07f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/0bde6e438035a3bb80ba4f735b8c61a68001f8aa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3a05f8579fc0a3d04e1e9de766630a722d7ca6b6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/51731e49fe9a7359d4dd17e77189a21b29115233"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5ba8a7ebd96d2e271905348e8aed19fe726e3648"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138850.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138850"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"334f1a1cbe032d85fd58e771629e3a3b373b96d5"},{"fixed":"3a05f8579fc0a3d04e1e9de766630a722d7ca6b6"},{"fixed":"0bde6e438035a3bb80ba4f735b8c61a68001f8aa"},{"fixed":"5ba8a7ebd96d2e271905348e8aed19fe726e3648"},{"fixed":"51731e49fe9a7359d4dd17e77189a21b29115233"},{"fixed":"09fa66ec1b4896ab841da085ca58b6433f28f07f"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138850.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.118"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.64"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138850.json"}}],"schema_version":"1.9.2"}