{"id":"CVE-2026-138899","summary":"mm/huge_memory: skip zone device folios in madvise_free_huge_pmd()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/huge_memory: skip zone device folios in madvise_free_huge_pmd()\n\nPatch series \"mm: reject zone device folios in more folio walkers\", v2.\n\nSeveral LRU-oriented mm walkers resolve the folio backing a PMD entry (or\na physical pfn) and then reclaim, age, migrate, or lazyfree it without\never checking for ZONE_DEVICE memory.\n\nThis series adds missing folio_is_zone_device() rejections, matching the\nchecks that comparable walkers already perform.\n\n- mm/huge_memory, mm/madvise: the !pmd_present branch above these sites\n  only filters device-private entries (which are non-present).\n\n  A present zone device PMD (e.g. device-coherent) would still reach the\n  folio and be lazyfreed / aged / paged out. Add an explicit check.\n\n- mm/mempolicy: queue_folios_pmd() can see a present zone device PMD\n  (e.g. device-coherent) and queue it for migration.\n\nNo crash reproducer - this is a correctness/hardening cleanup found by\ninspection.  All checks are placed after the folio is resolved and before\nit is acted upon, on paths that already hold the relevant page-table lock,\nso no locking or refcount changes are involved.\n\n\nThis patch (of 3):\n\nmadvise_free_huge_pmd() resolves the folio backing a PMD via pmd_folio()\nand marks it lazyfree without checking for zone device memory.\n\nThe surrounding guards do not cover every zone device case:\n\n - MADV_FREE only operates on anonymous VMAs (DAX mappings are excluded)\n\n - !pmd_present() branch rejects device-private and migration entries\n\n - present zone device PMD (device coherent THP) is not filtered.\n   Unlike vm_normal_page_pmd(), it performs no special/pfnmap check,\n   and would be marked lazyfree here.\n\nBail out when the folio is a zone device folio.","modified":"2026-12-01T21:02:35.094693140Z","published":"2026-11-30T13:26:01.377Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138899.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/3a09df924fa2ba75ac80acb9bce4eed79be218fa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/79b8838922c0f2eb2a7e58b5b4185d9d92992fed"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138899.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138899"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"a30b48bf1b244f11bf9b6d20cdccfe0c2264130c"},{"fixed":"79b8838922c0f2eb2a7e58b5b4185d9d92992fed"},{"fixed":"3a09df924fa2ba75ac80acb9bce4eed79be218fa"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138899.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"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-138899.json"}}],"schema_version":"1.9.2"}