CVE-2026-99816: fs/ntfs3: take run_lock when freeing offs_folio in ni_decompress_file
In the Linux kernel, the following vulnerability has been resolved:
fs/ntfs3: take runlock when freeing offsfolio in nidecompressfile
attrwofframeinfo() allocates, caches and dereferences ni->file.offsfolio under downwrite(&ni->file.runlock). nidecompressfile() frees the same folio with folioput() without taking runlock. When a WOF externally-compressed file is opened for write, nidecompressfile() can drop the last reference while a concurrent ORDONLY reader is dereferencing the folio in attrwofframeinfo(), leading to a use-after-free:
BUG: KASAN: use-after-free in attrwofframeinfo (fs/ntfs3/attrib.c:1619) Read of size 4 at addr ffff8880120c9000 by task exploit Call Trace: attrwofframeinfo (fs/ntfs3/attrib.c:1619) nireadframe (fs/ntfs3/frecord.c:2421) nireadfoliocmpr (fs/ntfs3/frecord.c:1916) ntfsreadfolio (fs/ntfs3/inode.c:648) readpages (mm/readahead.c:181) pagecacheraunbounded (mm/readahead.c:292) forcepagecachera (mm/readahead.c:364) pagecachesyncra (mm/readahead.c:573) filemapgetpages (mm/filemap.c:2688) filemapread (mm/filemap.c:2806) genericfilereaditer (mm/filemap.c:2994) ntfsfilereaditer (fs/ntfs3/file.c:842) vfsread (fs/readwrite.c:574) x64syspread64 (fs/readwrite.c:773)
Take runlock around the folioput(), as is done for every other access to ni->file.offsfolio.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In ni_decompress_file(), take ni->file.run_lock around the folio_put() that frees offs_folio.