CVE-2026-99111: smb: client: fix data corruption with concurrent writes and O_TRUNC
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix data corruption with concurrent writes and OTRUNC
cifsdotruncate() flushes dirty pages with filemapwriteandwait() and truncates the file on the server, but in the old code both operations ran without holding irwsem or invalidatelock. A concurrent buffered write via netfsperformwrite() -- which only needs irwsem shared -- could dirty new pages after the flush but before the local truncation, and those pages would be silently discarded by cifssetsize() -> truncatepagecache().
Fix by acquiring inodelock (exclusive irwsem) and filemapinvalidatelock at the top of cifsdotruncate(), so the entire flush-truncate-resize sequence is atomic with respect to:
- buffered writes (blocked by exclusive irwsem, since netfsstartiowrite takes irwsem shared), - read page faults (blocked by exclusive invalidatelock, since filemapfault takes it shared), - writeback collection (blocked by netfswbbegin/netfswbend around the server truncate and local resize, since netfswritepages also acquires the wb lock).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.59 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.2.13 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.2.13-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.116-1Fixed in 7.2.15-1Fixed in 7.3.3-1 - Compensating control
Modify cifs_do_truncate() to acquire inode_lock (exclusive i_rwsem) and filemap_invalidate_lock at the start, making the flush-truncate-resize sequence atomic with respect to buffered writes, read page faults, and writeback collection.
Event History
Frequently Asked Questions
Who is exposed to this issue?
Linux systems using the SMB/CIFS client are exposed when the same file is subject to concurrent buffered writes and a truncation operation using O_TRUNC. The impact described is silent loss of newly dirtied page-cache data during the truncate sequence.
What timing is required for data corruption?
A buffered write must dirty pages after cifs_do_truncate() has flushed dirty pages but before it performs the local page-cache truncation through cifs_setsize(). In the affected code, that race was possible because the flush and truncate operations were not protected by the required inode and invalidate locks.
How can I tell whether a system has the fix?
The resolved implementation acquires the inode lock exclusively and takes filemap_invalidate_lock at the start of cifs_do_truncate(), with writeback protection around the server truncate and local resize. The provided references identify the stable-kernel commits containing the fix.