CVE-2026-99416 in Linux
Summary
by MITRE • 11/19/2026
In the Linux kernel, the following vulnerability has been resolved:
ovl: read the nlink xattr of every indexed non-dir
With nfs_export=on, data written through a file handle to a lower file, i.e. a file that exists only in a lower layer of the overlay, can be lost on the next mount. A lookup of the file by name then returns -EIO. Also, a file with one name reports st_nlink 2 once it has been copied to the upper layer. After such a file is removed, its file handle can still open it until the next mount.
Before a lower file is changed for the first time, overlayfs copies it to the writable upper layer. This is called copy up.
The index directory is $workdir/index, where $workdir is the directory given by the workdir= option. Each entry is named after the file handle of a lower inode, so that overlayfs can get from the handle to the copied up inode.
With nfs_export=on, copy up indexes every non-directory: it copies the file to an entry in the index directory and then hard links that entry into the upper directory. The index entry is an extra link to the upper inode, so overlayfs stores the link count that users should see in the overlay.nlink xattr.
A file can also be opened by handle, either by an NFS client or by a process with CAP_DAC_READ_SEARCH calling open_by_handle_at(). If the file is not in the dcache, its overlay dentry is disconnected, i.e. it has no parent yet. Copy up then creates the index entry but no hard link in the upper directory. The index entry has i_nlink 1 and holds the only copy of the data written to the file.
ovl_get_nlink() reads the stored count. Its caller passes a default, which the function returns if there is no stored count. If the lower inode has i_nlink 1, the function returns the default without reading the xattr. That was correct as long as only lower files with multiple links were indexed.
On the next mount, ovl_verify_index() looks for orphans, i.e. index entries of files whose last name was removed. For an index entry with i_nlink 1, it passes a default of 0 to ovl_get_nlink() and treats a result of 0 as an orphan. Here the lower inode also has i_nlink 1, so the result is the default. ovl_indexdir_cleanup() then replaces the entry with a whiteout, which in the index marks a file as deleted. The written data is lost.
A lookup by name then returns -EIO, because a whiteout as the index entry of a lower file that still exists is a bad index.
ovl_get_inode() gets the wrong count the same way. Its default is the i_nlink of the upper inode, which includes the index entry, so a copied up file with one name reports st_nlink 2.
When that name is removed, the count drops to 1 rather than 0. ovl_nlink_end() replaces the index entry with a whiteout only at a count of 0, so the entry stays, and the handle of the removed file still opens it.
Reproduced by writing through open_by_handle_at() to an uncached lower file with one link. After a remount the data was lost, and the name returned EIO.
Fix this by adding an argument to ovl_get_nlink() that says whether the caller found an index entry, and by skipping the xattr only if the caller found none.
Known gaps: - An index entry that a kernel without this patch left behind for a removed file now stays, and the handle of that file keeps working. The entry has i_nlink 1 and a stored count of 1, just like the entry of a file that was only written by handle. Without this patch, the next mount treated it as an orphan.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/22/2026
The vulnerability described involves a critical logic error within the overlayfs implementation in the Linux kernel, specifically affecting how link counts and index entries are managed for files accessed via NFS exports or file handles. The core issue arises from incorrect handling of extended attributes (xattrs) that store the hard link count when an indexed non-directory inode is read. This flaw leads to data loss upon remounting and inconsistent state reporting during runtime, undermining the integrity guarantees expected from filesystem operations involving copy-up mechanisms.
Overlayfs operates by maintaining a lower layer containing original files and an upper writable layer where changes are stored via a process known as copy up. When nfs_export is enabled, overlayfs indexes every non-directory file to facilitate access through NFS handles or open_by_handle_at calls for processes with specific capabilities. During this indexing process, the system creates an entry in the index directory corresponding to the lower inode's handle and hard links it into the upper directory. To manage link counts correctly across these layers, overlayfs stores the expected user-visible link count in a special attribute named overlay.nlink. The function ovl_get_nlink is responsible for retrieving this stored value but contains a flawed optimization: if the underlying lower inode reports an i_nlink of one, it assumes no xattr exists and returns a default value instead of reading the actual stored count. This assumption was historically valid only when files with multiple links were indexed, but fails in scenarios where single-link files are written to via file handles before being fully cached or linked by name.
The operational impact manifests primarily during filesystem remounts due to incorrect orphan detection logic. When a lower inode has an i_nlink of one and is accessed via handle without having been previously hard-linked into the upper directory, ovl_get_nlink incorrectly returns the default value rather than the stored count. Upon subsequent mounting, the verification routine ovl_verify_index scans for orphans—index entries associated with files whose last name was removed. Because it receives an incorrect link count of zero due to the aforementioned bug, it mistakenly identifies valid index entries as orphaned. Consequently, ovl_indexdir_cleanup replaces these legitimate entries with whiteouts, effectively marking existing data as deleted and causing permanent loss of any data written through file handles prior to remounting.
Beyond data persistence issues, this vulnerability also causes significant state inconsistencies during normal operation. The function ovl_get_inode utilizes similar logic to determine the link count for stat operations. It defaults to the i_nlink of the upper inode which includes the index entry itself. As a result, a file with only one name reports an st_nlink value of two instead of one after being copied up. When that single hard link is removed, the internal counter drops to one rather than zero because the system fails to recognize that all references have been eliminated. The cleanup function ovl_nlink_end relies on reaching a count of zero to remove the index entry and whiteout the file. Since the count remains at one, the index entry persists erroneously. This allows stale file handles associated with deleted files to continue opening and accessing data long after they should be invalid, creating potential security risks related to unauthorized access or use-after-free scenarios if memory management interacts poorly with these lingering references.
From a classification perspective, this vulnerability aligns with CWE-20 Improper Input Validation as the kernel fails to correctly validate the state of extended attributes against actual inode link counts. It also relates to CWE-617 Reachable Assertion which reflects the logical failure in verifying index integrity during mount verification. In terms of ATT&CK mapping, while not an exploit technique itself, this flaw enables potential data destruction (T1485 Data Destruction) and unauthorized access via stale handles if exploited by a local attacker with CAP_DAC_READ_SEARCH privileges to manipulate file handle operations.
Mitigation strategies require applying the kernel patch that modifies ovl_get_nlink to accept an argument indicating whether an index entry was found, thereby ensuring the xattr is read regardless of the lower inode's link count when appropriate. Administrators should ensure their systems are updated with this fix to prevent data loss on remounts and stale handle access. Until patches are applied, avoiding nfs_export=on for critical workloads or minimizing use of open_by_handle_at() can reduce exposure. Regular backups remain essential given the risk of silent data corruption during filesystem mounts when this vulnerability is present in older kernel versions lacking these corrections.