{"id":"CVE-2024-49964","summary":"mm/hugetlb: fix memfd_pin_folios free_huge_pages leak","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/hugetlb: fix memfd_pin_folios free_huge_pages leak\n\nmemfd_pin_folios followed by unpin_folios fails to restore free_huge_pages\nif the pages were not already faulted in, because the folio refcount for\npages created by memfd_alloc_folio never goes to 0.  memfd_pin_folios\nneeds another folio_put to undo the folio_try_get below:\n\nmemfd_alloc_folio()\n  alloc_hugetlb_folio_nodemask()\n    dequeue_hugetlb_folio_nodemask()\n      dequeue_hugetlb_folio_node_exact()\n        folio_ref_unfreeze(folio, 1);    ; adds 1 refcount\n  folio_try_get()                        ; adds 1 refcount\n  hugetlb_add_to_page_cache()            ; adds 512 refcount (on x86)\n\nWith the fix, after memfd_pin_folios + unpin_folios, the refcount for the\n(unfaulted) page is 512, which is correct, as the refcount for a faulted\nunpinned page is 513.","modified":"2026-04-02T12:21:10.562130Z","published":"2024-10-21T18:02:15.755Z","related":["USN-7276-1","USN-7277-1","openSUSE-SU-2024:14500-1","openSUSE-SU-2025:14705-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49964.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/59e081ff2e91bbf19b8c1ecb75b031f778858383"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c56b6f3d801d7ec8965993342bdd9e2972b6cb8e"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/49xxx/CVE-2024-49964.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49964"},{"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":"89c1905d9c140372b7f50ef48f42378cf85d9bc5"},{"fixed":"59e081ff2e91bbf19b8c1ecb75b031f778858383"},{"fixed":"c56b6f3d801d7ec8965993342bdd9e2972b6cb8e"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-49964.json"}}],"schema_version":"1.7.5"}