{"id":"CVE-2026-99642","summary":"mm/gup: check folio-\u003emapping under folio lock in memfd_pin_folios()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/gup: check folio-\u003emapping under folio lock in memfd_pin_folios()\n\nmemfd_pin_folios() pins folios from the page cache without taking the\nfolio lock. khugepaged or MADV_COLLAPSE can therefore replace a folio\nafter checking its refcount while memfd_pin_folios() still pins the old\nfolio. The caller then receives a folio which is no longer part of the\nmemfd.\n\nFor udmabuf and iommufd, this can cause data corruption: DMA accesses\nthe detached folio rather than the live memfd contents. DMA reads can\nreturn stale data, while DMA writes update the detached copy and are\nlost from the live memfd. The detached folio remains pinned, so these\naccesses do not constitute a use-after-free or target another\napplication's memory. For memfd live update, the stale contents can\nreappear in the memfd after handover.\n\nLock the folio and recheck folio-\u003emapping before pinning it, like other\npage cache users do. If the folio was removed, retry the folio lookup\nfrom the index that was removed.","modified":"2026-11-20T07:00:56.623858003Z","published":"2026-11-20T05:49:57.651Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99642.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/240bc9b873d3522672db13ea93ec73b7f0461912"},{"type":"WEB","url":"https://git.kernel.org/stable/c/4480eb27975b91a28bc058a2ca16f466ebd9d7cd"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6ac69b444b85d0e511d9bc15f586ebeed49322fa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/71555ae8c7572fd99158013ca2e29187c5d2508d"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99642.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99642"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"89c1905d9c140372b7f50ef48f42378cf85d9bc5"},{"fixed":"240bc9b873d3522672db13ea93ec73b7f0461912"},{"fixed":"4480eb27975b91a28bc058a2ca16f466ebd9d7cd"},{"fixed":"6ac69b444b85d0e511d9bc15f586ebeed49322fa"},{"fixed":"71555ae8c7572fd99158013ca2e29187c5d2508d"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99642.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.11.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.5"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99642.json"}}],"schema_version":"1.9.2"}