{"id":"CVE-2026-138899","aliases":["CVE-2026-138899"],"related":[],"kind":"vulnerability","state":"published","title":"mm/huge_memory: skip zone device folios in madvise_free_huge_pmd()","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"}],"published":"2026-11-30T13:26:01.377Z","modified":"2026-11-30T14:17:47.840Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"a30b48bf1b244f11bf9b6d20cdccfe0c2264130c","fixed":"79b8838922c0f2eb2a7e58b5b4185d9d92992fed","status":"affected"},{"type":"git","introduced":"a30b48bf1b244f11bf9b6d20cdccfe0c2264130c","fixed":"3a09df924fa2ba75ac80acb9bce4eed79be218fa","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.19","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.19","status":"unaffected"},{"type":"semver","introduced":"7.3.4","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/79b8838922c0f2eb2a7e58b5b4185d9d92992fed","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3a09df924fa2ba75ac80acb9bce4eed79be218fa","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-138899","url":"https://www.cve.org/CVERecord?id=CVE-2026-138899","licence":"CVE Terms of Use","modified":"2026-11-30T13:26:01.377Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-138899","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138899","licence":"Public domain","modified":"2026-11-30T14:17:47.840Z"}],"updatedAt":"2026-11-30T14:32:30.834Z","epss":{"score":0.00198,"percentile":0.1011,"date":"2026-12-01T12:00:22.000Z"}}