CVE-2026-99732 in Linuxinfo

Summary

by MITRE • 11/20/2026

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

mm/filemap: read mapping->a_ops->free_folio under i_lock

memory_failure() -> ... -> filemap_remove_folio() can read mapping->a_ops after the inode has been freed. Once the folio is deleted from the pagecache it no longer pins the mapping, so after i_lock is dropped e.g., a concurrent final iput() can evict and free the inode before filemap_free_folio() looks up mapping->a_ops->free_folio.

Most callers hold a reference on the inode, but not all.

Documentation/filesystems/vfs.rst explicitly states that ->free_folio() must not assume the original address_space mapping still exists.

Fix it by loading ->free_folio while i_lock is still held, similar to what folio_unmap_invalidate() does.

Inline filemap_free_folio() into its remaining caller such that delete_from_page_cache_batch() also just loads the callback before dropping the i_lock.

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 filemap_free_folio() entirely; improve patch description ]

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 11/20/2026

A critical race condition exists within the Linux kernel memory management subsystem, specifically involving the interaction between inode lifecycle management and page cache operations. The vulnerability centers on the function filemap_remove_folio(), which is invoked during memory failure handling sequences such as memory_failure(). In this context, the code attempts to access mapping->a_ops->free_folio after a folio has been removed from the page cache. Under normal circumstances, holding a reference to an inode prevents its premature destruction; however, not all callers of these functions maintain such references. Consequently, once the folio is deleted from the page cache, it no longer pins the associated address_space mapping structure. This creates a window where dropping the i_lock allows concurrent operations, particularly a final iput() call, to evict and completely free the inode before filemap_free_folio() attempts to look up the callback function pointer within the now-freed memory region.

The technical flaw stems from an incorrect assumption about object lifetime relative to lock scope. While Documentation/filesystems/vfs.rst explicitly mandates that the ->free_folio() method must not assume the original address_space mapping still exists, the implementation failed to adhere to this constraint by accessing the pointer after releasing synchronization primitives. This leads to a use-after-free scenario where kernel code dereferences memory belonging to a freed inode structure. Such an access pattern typically results in undefined behavior, which can manifest as kernel panics, data corruption, or potentially exploitable conditions if an attacker can influence the timing of concurrent iput() operations relative to page cache removals. The issue was identified through rigorous static code inspection rather than runtime reproduction, indicating a latent defect that relies on specific concurrency patterns to trigger.

From a classification perspective, this vulnerability aligns with CWE-416, Use After Free, as it involves accessing memory after it has been freed due to improper synchronization of resource lifecycles. In the context of the MITRE ATT&CK framework for enterprise security, this type of kernel-level race condition can be leveraged in techniques related to privilege escalation or denial of service by causing system instability. The lack of proper reference counting combined with premature pointer dereference represents a fundamental flaw in concurrent programming practices within the VFS layer.

The resolution involves restructuring the code flow to ensure that the function pointer mapping->a_ops->free_folio is loaded while the i_lock is still held, thereby guaranteeing that the inode remains valid during the lookup operation. This approach mirrors the safe pattern already implemented in folio_unmap_invalidate(). Furthermore, the fix includes inlining filemap_free_folio() into its remaining caller to ensure that delete_from_page_cache_batch() also loads the callback before dropping the i_lock. By eliminating the separate function call and ensuring atomicity of the pointer load relative to lock release, the race condition is closed. This patch was generated with assistance from an LLM and reviewed by kernel developers to correct the description and remove unnecessary abstractions, resulting in a more robust synchronization mechanism that prevents access to freed memory structures during concurrent inode eviction scenarios.

Responsible

Linux

Reservation

09/25/2026

Disclosure

11/20/2026

Moderation

accepted

CPE

ready

EPSS

0.00156

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!