{"id":"CVE-2025-71069","summary":"f2fs: invalidate dentry cache on failed whiteout creation","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: invalidate dentry cache on failed whiteout creation\n\nF2FS can mount filesystems with corrupted directory depth values that\nget runtime-clamped to MAX_DIR_HASH_DEPTH. When RENAME_WHITEOUT\noperations are performed on such directories, f2fs_rename performs\ndirectory modifications (updating target entry and deleting source\nentry) before attempting to add the whiteout entry via f2fs_add_link.\n\nIf f2fs_add_link fails due to the corrupted directory structure, the\nfunction returns an error to VFS, but the partial directory\nmodifications have already been committed to disk. VFS assumes the\nentire rename operation failed and does not update the dentry cache,\nleaving stale mappings.\n\nIn the error path, VFS does not call d_move() to update the dentry\ncache. This results in new_dentry still pointing to the old inode\n(new_inode) which has already had its i_nlink decremented to zero.\nThe stale cache causes subsequent operations to incorrectly reference\nthe freed inode.\n\nThis causes subsequent operations to use cached dentry information that\nno longer matches the on-disk state. When a second rename targets the\nsame entry, VFS attempts to decrement i_nlink on the stale inode, which\nmay already have i_nlink=0, triggering a WARNING in drop_nlink().\n\nExample sequence:\n1. First rename (RENAME_WHITEOUT): file2 → file1\n   - f2fs updates file1 entry on disk (points to inode 8)\n   - f2fs deletes file2 entry on disk\n   - f2fs_add_link(whiteout) fails (corrupted directory)\n   - Returns error to VFS\n   - VFS does not call d_move() due to error\n   - VFS cache still has: file1 → inode 7 (stale!)\n   - inode 7 has i_nlink=0 (already decremented)\n\n2. Second rename: file3 → file1\n   - VFS uses stale cache: file1 → inode 7\n   - Tries to drop_nlink on inode 7 (i_nlink already 0)\n   - WARNING in drop_nlink()\n\nFix this by explicitly invalidating old_dentry and new_dentry when\nf2fs_add_link fails during whiteout creation. This forces VFS to\nrefresh from disk on subsequent operations, ensuring cache consistency\neven when the rename partially succeeds.\n\nReproducer:\n1. Mount F2FS image with corrupted i_current_depth\n2. renameat2(file2, file1, RENAME_WHITEOUT)\n3. renameat2(file3, file1, 0)\n4. System triggers WARNING in drop_nlink()","modified":"2026-03-20T12:46:34.456574Z","published":"2026-01-13T15:31:23.948Z","related":["MGASA-2026-0017","MGASA-2026-0018"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/71xxx/CVE-2025-71069.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/0dde30753c1e8648665dbe069d814e540ce2fd37"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3d65e27e57aaa9d66709fda4cbfb62a87c04a3f5"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3d95ed8cf980fdfa67a3ab9491357521ae576168"},{"type":"WEB","url":"https://git.kernel.org/stable/c/64587ab4d1f16fc94f70e04fa87b2e3f69f8a7bb"},{"type":"WEB","url":"https://git.kernel.org/stable/c/7f2bae0c881aa1e0a6318756df692cc13df2cc83"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c89845fae250efdd59c1d4ec60e9e1c652cee4b6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d33f89b34aa313f50f9a512d58dd288999f246b0"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/71xxx/CVE-2025-71069.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71069"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"7e01e7ad746bc8198a8b46163ddc73a1c7d22339"},{"fixed":"7f2bae0c881aa1e0a6318756df692cc13df2cc83"},{"fixed":"3d95ed8cf980fdfa67a3ab9491357521ae576168"},{"fixed":"64587ab4d1f16fc94f70e04fa87b2e3f69f8a7bb"},{"fixed":"3d65e27e57aaa9d66709fda4cbfb62a87c04a3f5"},{"fixed":"c89845fae250efdd59c1d4ec60e9e1c652cee4b6"},{"fixed":"0dde30753c1e8648665dbe069d814e540ce2fd37"},{"fixed":"d33f89b34aa313f50f9a512d58dd288999f246b0"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-71069.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.2.0"},{"fixed":"5.10.248"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.198"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.160"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.64"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.3"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-71069.json"}}],"schema_version":"1.7.5"}