{"id":"CVE-2026-99429","summary":"ocfs2: pin refcount trees before dropping the lookup lock","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: pin refcount trees before dropping the lookup lock\n\nA refcount tree returned to ocfs2_lock_refcount_tree() must stay alive\nuntil that caller releases its operation reference. However,\nocfs2_get_refcount_tree() returns the cached pointer after dropping\nosb_lock, and the caller only takes its kref afterwards. The registry\nreference does not protect this gap from concurrent removal.\n\nThis can happen when another node frees a refcount root and reuses its\nblock with a different generation while this mount retains the old\ncached tree. Two local operations on different inodes sharing the new\nroot, such as data CoW and an external xattr update, can then look up\nthe same stale tree. Their inode locks are independent, and both the\nREFCOUNT DLM lock and rf_sem are acquired after the first operation\nreference.\n\nThe following ordering is possible, with no other operation references:\n\n  Data CoW                         Xattr update\n  --------                         ------------\n  Look up the old tree under\n    osb_lock, then drop osb_lock\n                                   Look up the same tree and take a kref\n                                   Acquire the tree locks and read the\n                                     new on-disk generation\n                                   Erase the old tree under osb_lock\n                                   Unlock and drop the operation kref\n                                   Drop the registry kref, freeing tree\n  Take a kref through the\n    freed tree pointer\n\nThe final kref_get() accesses freed rf_getcnt storage, and subsequent\naccesses in ocfs2_lock_refcount_tree() also use the freed allocation.\n\nTake the operation reference in ocfs2_get_refcount_tree() before\nreleasing osb_lock, including when an insertion loses to another lookup.\nRemoval must acquire the same lock, so it cannot drop the registry\nreference before the lookup has pinned the tree. Keep the existing\nunlock and error path puts. The two callers that already hold the\nrefcount tree lock keep their borrowed lookup behavior and do not\nacquire an extra reference.\n\nKASAN report as below:\n\n    BUG: KASAN: slab-use-after-free in ocfs2_lock_refcount_tree+0x94a/0x9b0\n    Read of size 4 at addr ffff888117212820 by task python3/497\n\n[Kernel and hardware identification omitted.]\n\n    Call Trace:\n     \u003cTASK\u003e\n     dump_stack_lvl+0x93/0xd0\n     print_report+0xce/0x630\n     ? ocfs2_lock_refcount_tree+0x94a/0x9b0\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     ? __virt_addr_valid+0x20e/0x420\n     ? ocfs2_lock_refcount_tree+0x94a/0x9b0\n     kasan_report+0xe0/0x110\n     ? ocfs2_lock_refcount_tree+0x94a/0x9b0\n     ocfs2_lock_refcount_tree+0x94a/0x9b0\n     ? __pfx_ocfs2_lock_refcount_tree+0x10/0x10\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     ? ocfs2_refcount_cow+0x3b6/0xd90\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     ? __kmalloc_cache_noprof+0x28d/0x610\n     ? ocfs2_refcount_cow+0x3b6/0xd90\n     ocfs2_refcount_cow+0x410/0xd90\n     ? __pfx_ocfs2_refcount_cow+0x10/0x10\n     ? __pfx___might_resched+0x10/0x10\n     ? down_write+0x11a/0x1f0\n     ? __pfx_down_write+0x10/0x10\n     ? ocfs2_inode_unlock+0x1a9/0x260\n     ? __pfx_ocfs2_inode_unlock+0x10/0x10\n     ? ocfs2_file_write_iter+0x1413/0x1d30\n     ocfs2_file_write_iter+0x157b/0x1d30\n     ? __pfx_ocfs2_file_write_iter+0x10/0x10\n     ? lock_acquire+0x190/0x300\n     ? __x64_sys_pwrite64+0x1b7/0x220\n     ? __pfx___might_resched+0x10/0x10\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     ? security_file_permission+0x26/0x80\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     ? lock_is_held_type+0x8f/0x100\n     vfs_write+0x639/0x1010\n     ? __pfx_ocfs2_file_write_iter+0x10/0x10\n     ? lock_vma_under_rcu+0x154/0x4a0\n     ? __pfx_vfs_write+0x10/0x10\n     ? lock_release+0x121/0x290\n     ? srso_alias_return_thunk+0x5/0xfbef5\n     __x64_sys_pwrite64+0x1b7/0x220\n     ? __pfx___x64_sys_pwrite64+0x10/0x10\n     ? irqentry_exit+0xbe/0x820\n---truncated---","modified":"2026-11-19T17:01:13.280433302Z","published":"2026-11-19T14:40:51.812Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99429.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2d9e864c234469dc7f56ea974f8269d251441e6a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/7ff4f020f7b03fddd529735f0b61ac0a8dd92c9e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8c714a074074af7ae59233c1fa6ef9d7aa710462"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ce7b46556af15642a1e9f8d0c596022dd7cfb4a7"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99429.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99429"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"374a263e790c4de85844283c098810a92985f623"},{"fixed":"ce7b46556af15642a1e9f8d0c596022dd7cfb4a7"},{"fixed":"7ff4f020f7b03fddd529735f0b61ac0a8dd92c9e"},{"fixed":"2d9e864c234469dc7f56ea974f8269d251441e6a"},{"fixed":"8c714a074074af7ae59233c1fa6ef9d7aa710462"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99429.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.32"},{"fixed":"6.12.117"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.61"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.2"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99429.json"}}],"schema_version":"1.9.2"}