CVE-2025-68809 Overview
A race condition vulnerability has been discovered in the Linux kernel's ksmbd (in-kernel SMB server) subsystem. The vulnerability exists in the vfs_cache.c file where the m_flags field of the ksmbd_inode structure is accessed under inconsistent locking. Some code paths read and modify m_flags under ci->m_lock while others do so without taking the lock at all, creating a data race when multiple threads concurrently open, close, and delete the same file.
Critical Impact
This race condition can lead to delete-on-close and pending-delete bits being lost or observed in an inconsistent state, resulting in files that persist on disk after delete-on-close operations or files that disappear while still in use by other processes.
Affected Products
- Linux kernel with ksmbd (in-kernel SMB server) enabled
- Systems using ksmbd for SMB/CIFS file sharing services
Discovery Timeline
- 2026-01-13 - CVE CVE-2025-68809 published to NVD
- 2026-01-13 - Last updated in NVD database
Technical Details for CVE-2025-68809
Vulnerability Analysis
The vulnerability stems from inconsistent lock discipline when accessing the m_flags field within the ksmbd_inode structure. The ksmbd subsystem maintains delete-on-close and pending-delete state in this field, which is critical for proper SMB file deletion semantics. The race condition occurs because several functions access this shared state without proper synchronization.
Functions like ksmbd_query_inode_status() and __ksmbd_inode_close() correctly use ci->m_lock when checking or updating m_flags. However, other helper functions including ksmbd_inode_pending_delete(), ksmbd_set_inode_pending_delete(), ksmbd_clear_inode_pending_delete(), and ksmbd_fd_set_delete_on_close() previously read and modified m_flags without acquiring the lock.
This creates a Time-of-Check Time-of-Use (TOCTOU) style race condition where concurrent file operations can corrupt the delete state flags, leading to unpredictable file system behavior.
Root Cause
The root cause is a classic concurrency bug where shared mutable state (m_flags) is accessed from multiple execution contexts without consistent locking protection. The ci->m_lock spinlock exists to protect this data, but not all code paths were correctly using it, violating the kernel's locking discipline for this data structure.
Attack Vector
The vulnerability can be triggered when multiple threads or processes simultaneously perform open, close, and delete operations on the same file through the ksmbd SMB server. While this is primarily a local race condition within the kernel, it affects systems that expose ksmbd services for file sharing. In a worst-case scenario, an attacker with access to the SMB share could craft concurrent file operations to exploit this race, potentially causing denial of service through inconsistent file system state or bypassing intended file deletion semantics.
The fix unifies locking around m_flags by adding ci->m_lock protection to all helper functions that access this field, and moves the actual unlink/xattr removal operations outside the lock to preserve existing delete-on-close behavior while eliminating the data race.
Detection Methods for CVE-2025-68809
Indicators of Compromise
- Unexpected file persistence after delete-on-close operations on ksmbd-served shares
- Files disappearing while still being accessed by SMB clients
- Kernel log messages related to ksmbd inode state inconsistencies
- Anomalous behavior in concurrent file deletion scenarios on SMB shares
Detection Strategies
- Monitor kernel logs for ksmbd-related warnings or errors indicating inode state issues
- Audit systems for ksmbd service deployment and check kernel versions against patched releases
- Use kernel debugging tools to detect data races in ksmbd subsystem during testing
- Review SMB file sharing access patterns for unusual concurrent delete operations
Monitoring Recommendations
- Enable kernel auditing for file system operations on ksmbd-mounted shares
- Deploy endpoint detection solutions that can identify kernel-level race condition exploitation attempts
- Monitor for denial of service conditions caused by file system state corruption
- Track ksmbd service stability and any unexpected restarts or crashes
How to Mitigate CVE-2025-68809
Immediate Actions Required
- Update to a patched Linux kernel version that includes the race condition fix
- Consider temporarily disabling ksmbd service if not critical to operations until patching is complete
- Restrict access to SMB shares to trusted users and networks
- Implement network segmentation to limit exposure of ksmbd services
Patch Information
The vulnerability has been fixed in the Linux kernel through commits that unify the locking around m_flags. The patches ensure all functions that access or modify the ksmbd_inode->m_flags field properly acquire ci->m_lock before doing so.
Relevant kernel commits:
- Kernel Git Commit 5adad97
- Kernel Git Commit 991f8a7
- Kernel Git Commit ccc7878
- Kernel Git Commit ee63729
Workarounds
- If ksmbd is not required, disable it by not loading the ksmbd kernel module
- Use Samba user-space SMB server as an alternative to ksmbd until patching is possible
- Implement access controls to limit which users can perform file operations on affected shares
- Consider using network-level controls to restrict concurrent connections to SMB shares
# Disable ksmbd kernel module loading
echo "blacklist ksmbd" >> /etc/modprobe.d/ksmbd-blacklist.conf
# Unload the module if currently loaded
modprobe -r ksmbd
# Verify the module is not loaded
lsmod | grep ksmbd
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

