CVE-2026-99732: mm/filemap: read mapping->a_ops->free_folio under i_lock
In the Linux kernel, the following vulnerability has been resolved:
mm/filemap: read mapping->aops->freefolio under ilock
memoryfailure() -> ... -> filemapremovefolio() can read mapping->aops after the inode has been freed. Once the folio is deleted from the pagecache it no longer pins the mapping, so after ilock is dropped e.g., a concurrent final iput() can evict and free the inode before filemapfreefolio() looks up mapping->aops->freefolio.
Most callers hold a reference on the inode, but not all.
Documentation/filesystems/vfs.rst explicitly states that ->freefolio() must not assume the original addressspace mapping still exists.
Fix it by loading ->freefolio while ilock is still held, similar to what foliounmapinvalidate() does.
Inline filemapfreefolio() into its remaining caller such that deletefrompagecachebatch() also just loads the callback before dropping the ilock.
The bug was found by code inspection and has not been reproduced.
Fix generated by an LLM and sent by Josef Bacik in private.
[ david: get rid of filemapfreefolio() entirely; improve patch description ]
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5
Frequently Asked Questions
What conditions are required for this issue to occur?
The vulnerable path requires a folio to be removed from the page cache and the inode to be freed concurrently after i_lock is dropped but before the free_folio callback is read from mapping->a_ops. This can occur in callers that do not hold an inode reference; most callers do hold one.
Has this issue been observed in practice?
No. The issue was identified through code inspection and has not been reproduced.
Which component behavior is implicated?
The issue involves filesystems' address_space_operations free_folio callback handling. The VFS documentation states that free_folio must not assume that the original address_space mapping still exists.