# CVE-2024-49964: mm/hugetlb: fix memfd_pin_folios free_huge_pages leak

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.20%, higher than 10% of CVEs (2026-12-01)
- Published: 2024-10-21T18:02:15.755Z
- Modified: 2026-06-17T08:00:50.413Z
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

mm/hugetlb: fix memfd_pin_folios free_huge_pages leak

memfd_pin_folios followed by unpin_folios fails to restore free_huge_pages
if the pages were not already faulted in, because the folio refcount for
pages created by memfd_alloc_folio never goes to 0.  memfd_pin_folios
needs another folio_put to undo the folio_try_get below:

memfd_alloc_folio()
  alloc_hugetlb_folio_nodemask()
    dequeue_hugetlb_folio_nodemask()
      dequeue_hugetlb_folio_node_exact()
        folio_ref_unfreeze(folio, 1);    ; adds 1 refcount
  folio_try_get()                        ; adds 1 refcount
  hugetlb_add_to_page_cache()            ; adds 512 refcount (on x86)

With the fix, after memfd_pin_folios + unpin_folios, the refcount for the
(unfaulted) page is 512, which is correct, as the refcount for a faulted
unpinned page is 513.

(As written by CVE List.)

## Affected

- Linux Linux: from 89c1905d9c140372b7f50ef48f42378cf85d9bc5 before 59e081ff2e91bbf19b8c1ecb75b031f778858383; from 89c1905d9c140372b7f50ef48f42378cf85d9bc5 before c56b6f3d801d7ec8965993342bdd9e2972b6cb8e; 6.11 (not affected: before 6.11; from 6.11.3 up to 6.11.*; from 6.12 up to *)
- linux linux_kernel: from 6.11 before 6.11.3

## References

- <https://git.kernel.org/stable/c/59e081ff2e91bbf19b8c1ecb75b031f778858383> (patch)
- <https://git.kernel.org/stable/c/c56b6f3d801d7ec8965993342bdd9e2972b6cb8e> (patch)

## Sources

- CVE List: [CVE-2024-49964](https://www.cve.org/CVERecord?id=CVE-2024-49964), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2024-49964](https://nvd.nist.gov/vuln/detail/CVE-2024-49964), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2024-49964 · Whole record: https://cve.day/CVE-2024-49964.json · Rebuilt by cve.day 2026-11-25T22:58:47.068Z
