{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2026-99416","id":"CVE-2026-99416","title":"ovl: read the nlink xattr of every indexed non-dir","description":"In the Linux kernel, the following vulnerability has been resolved:\n\novl: read the nlink xattr of every indexed non-dir\n\nWith nfs_export=on, data written through a file handle to a lower file,\ni.e. a file that exists only in a lower layer of the overlay, can be\nlost on the next mount. A lookup of the file by name then returns -EIO.\nAlso, a file with one name reports st_nlink 2 once it has been cop","descriptionLong":"In the Linux kernel, the following vulnerability has been resolved:\n\novl: read the nlink xattr of every indexed non-dir\n\nWith nfs_export=on, data written through a file handle to a lower file,\ni.e. a file that exists only in a lower layer of the overlay, can be\nlost on the next mount. A lookup of the file by name then returns -EIO.\nAlso, a file with one name reports st_nlink 2 once it has been copied to\nthe upper layer. After such a file is removed, its file handle can still\nopen it until the next mount.\n\nBefore a lower file is changed for the first time, overlayfs copies it\nto the writable upper layer. This is called copy up.\n\nThe index directory is $workdir/index, where $workdir is the directory\ngiven by the workdir= option. Each entry is named after the file handle\nof a lower inode, so that overlayfs can get from the handle to the\ncopied up inode.\n\nWith nfs_export=on, copy up indexes every non-directory: it copies the\nfile to an entry in the index directory and then hard links that entry\ninto the upper directory. The index entry is an extra link to the upper\ninode, so overlayfs stores the link count that users should see in the\noverlay.nlink xattr.\n\nA file can also be opened by handle, either by an NFS client or by a\nprocess with CAP_DAC_READ_SEARCH calling open_by_handle_at(). If the\nfile is not in the dcache, its overlay dentry is disconnected, i.e. it\nhas no parent yet. Copy up then creates the index entry but no hard link\nin the upper directory. The index entry has i_nlink 1 and holds the only\ncopy of the data written to the file.\n\novl_get_nlink() reads the stored count. Its caller passes a default,\nwhich the function returns if there is no stored count. If the lower\ninode has i_nlink 1, the function returns the default without reading\nthe xattr. That was correct as long as only lower files with multiple\nlinks were indexed.\n\nOn the next mount, ovl_verify_index() looks for orphans, i.e. index\nentries of files whose last name was removed. For an index entry with\ni_nlink 1, it passes a default of 0 to ovl_get_nlink() and treats a\nresult of 0 as an orphan. Here the lower inode also has i_nlink 1, so\nthe result is the default. ovl_indexdir_cleanup() then replaces the\nentry with a whiteout, which in the index marks a file as deleted. The\nwritten data is lost.\n\nA lookup by name then returns -EIO, because a whiteout as the index\nentry of a lower file that still exists is a bad index.\n\novl_get_inode() gets the wrong count the same way. Its default is the\ni_nlink of the upper inode, which includes the index entry, so a copied\nup file with one name reports st_nlink 2.\n\nWhen that name is removed, the count drops to 1 rather than 0.\novl_nlink_end() replaces the index entry with a whiteout only at a count\nof 0, so the entry stays, and the handle of the removed file still opens\nit.\n\nReproduced by writing through open_by_handle_at() to an uncached lower\nfile with one link. After a remount the data was lost, and the name\nreturned EIO.\n\nFix this by adding an argument to ovl_get_nlink() that says whether the\ncaller found an index entry, and by skipping the xattr only if the\ncaller found none.\n\nKnown gaps:\n- An index entry that a kernel without this patch left behind for a\n  removed file now stays, and the handle of that file keeps working. The\n  entry has i_nlink 1 and a stored count of 1, just like the entry of a\n  file that was only written by handle. Without this patch, the next\n  mount treated it as an orphan.","published":"2026-11-19T14:40:14.495Z","updated":"2026-11-19T14:40:14.495Z","reserved":"2026-09-25T10:25:14.413Z","status":"PUBLISHED","rejected":false,"assigner":"Linux","metric":null,"metrics":[],"rating":"unrated","products":["Linux"],"affectedProducts":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"fbd2d2074bde2e333d9a9eeda5864cd593fbe29c","lessThan":"07b000b5b458723ca85d67dbbe5f6359c0202cfc","status":"affected","versionType":"git"},{"version":"fbd2d2074bde2e333d9a9eeda5864cd593fbe29c","lessThan":"9b50f28c22c948b0c134d5c5dbd62ea0ada97fc3","status":"affected","versionType":"git"},{"version":"fbd2d2074bde2e333d9a9eeda5864cd593fbe29c","lessThan":"ffe508adf85acdd57db01a234161e795b7403062","status":"affected","versionType":"git"},{"version":"fbd2d2074bde2e333d9a9eeda5864cd593fbe29c","lessThan":"eb644ed5c6d9afdb1554c41cef1f39d150fbc554","status":"affected","versionType":"git"}],"platforms":[]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.16","status":"affected"},{"version":"0","lessThan":"4.16","status":"unaffected","versionType":"semver"},{"version":"6.12.117","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.18.61","lessThanOrEqual":"6.18.*","status":"unaffected","versionType":"semver"},{"version":"7.3.2","lessThanOrEqual":"7.3.*","status":"unaffected","versionType":"semver"},{"version":"7.4-rc1","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}],"platforms":[]}],"packages":[],"cwes":[],"aliases":[],"references":[{"url":"https://git.kernel.org/stable/c/07b000b5b458723ca85d67dbbe5f6359c0202cfc","tags":[]},{"url":"https://git.kernel.org/stable/c/9b50f28c22c948b0c134d5c5dbd62ea0ada97fc3","tags":[]},{"url":"https://git.kernel.org/stable/c/ffe508adf85acdd57db01a234161e795b7403062","tags":[]},{"url":"https://git.kernel.org/stable/c/eb644ed5c6d9afdb1554c41cef1f39d150fbc554","tags":[]}],"patchReferenced":false,"fixAvailable":false,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":null,"epss":null,"epssPercentile":null,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-99416","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99416","ok":false,"note":"not found"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2026-99416","ok":false,"note":"no open-source package data"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-99416","ok":false,"note":"no score yet"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}