CVE-2025-22000: mm/huge_memory: drop beyond-EOF folios with the right number of refs
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mm/huge_memory: drop beyond-EOF folios with the right number of refs
When an after-split folio is large and needs to be dropped due to EOF, folio_put_refs(folio, folio_nr_pages(folio)) should be used to drop all page cache refs. Otherwise, the folio will not be freed, causing memory leak.
This leak would happen on a filesystem with blocksize > page_size and a truncate is performed, where the blocksize makes folios split to >0 order ones, causing truncated folios not being freed.
The Linux kernel CVE team has assigned CVE-2025-22000 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.9 with commit c010d47f107f609b9f4d6a103b6dfc53889049e9 and fixed in 6.12.21 with commit 86368616a9ce51f6b41efa251b6e066893851d67 Issue introduced in 6.9 with commit c010d47f107f609b9f4d6a103b6dfc53889049e9 and fixed in 6.13.9 with commit 92ad820a1f2d95d5a8d6c2bd3f391bbb068a5f9e Issue introduced in 6.9 with commit c010d47f107f609b9f4d6a103b6dfc53889049e9 and fixed in 6.14 with commit 14efb4793519d73fb2902bb0ece319b886e4b4b9
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-22000
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
mm/huge_memory.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/86368616a9ce51f6b41efa251b6e066893851d67 https://git.kernel.org/stable/c/92ad820a1f2d95d5a8d6c2bd3f391bbb068a5f9e https://git.kernel.org/stable/c/14efb4793519d73fb2902bb0ece319b886e4b4b9