CVE-2026-99820 in Linux
Summary
by MITRE • 11/30/2026
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: fix array out of bound access in __ocfs2_find_path()
__ocfs2_find_path() walks down the extent tree and records path by calling find_path_ins(), which appends entry to path->p_node[]. It only has 5
spots.
A corrupted ocfs2 image whose extent block is pointing to itself causes __ocfs2_find_path() descent endlessly, writing past the end of path->p_node[] array.
UBSAN: array-index-out-of-bounds in fs/ocfs2/alloc.c:677:14 index 5 is out of range for type 'ocfs2_path_item [5]'
Call Trace: <TASK> find_path_ins (fs/ocfs2/alloc.c:677 fs/ocfs2/alloc.c:1914) __ocfs2_find_path.constprop.0 (fs/ocfs2/alloc.c:1882) ocfs2_commit_truncate (fs/ocfs2/alloc.c:1924 fs/ocfs2/alloc.c:7286) ocfs2_truncate_file (fs/ocfs2/file.c:515) ocfs2_setattr (fs/ocfs2/file.c:1224) notify_change (fs/attr.c:556) do_truncate (fs/open.c:68) do_ftruncate (fs/open.c:194 (discriminator 1)) ksys_ftruncate (fs/open.c:206) __x64_sys_ftruncate (fs/open.c:211 fs/open.c:209 fs/open.c:209)
Commit a406aff8c051 ("ocfs2: validate l_tree_depth to avoid out-of-bounds access") already restricts el->l_tree_depth to be less than OCFS2_MAX_PATH_DEPTH, which is equal to 5. However, does not handle the infinite descent case.
Check if the el->l_tree_depth decreases on each descent. Maximum descents are restricted to 4 and the path->p_node[] array does not overflow.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/30/2026
The vulnerability identified in the Linux kernel's OCFS2 filesystem driver represents a critical out-of-bounds memory access issue within the __ocfs2_find_path function. This component is responsible for traversing the extent tree structure of an ocfs2 volume to locate specific data blocks or metadata nodes. The traversal logic relies on a helper function called find_path_ins, which appends path items to a fixed-size array designated as path->p_node[]. This array has a strict capacity limit defined by OCFS2_MAX_PATH_DEPTH, which is set to five entries. Under normal operational conditions, the depth of the extent tree remains within this bound, ensuring that every descent into lower levels of the tree results in a valid index write operation. However, when presented with a maliciously crafted or corrupted ocfs2 image where an extent block contains metadata pointing back to itself, the traversal logic enters an infinite loop. Instead of descending through distinct nodes at increasing depths, the function repeatedly processes the same node structure without progressing deeper into unique tree levels.
This circular reference causes __ocfs2_find_path() to call find_path_ins recursively or iteratively beyond the allocated limits of the path->p_node[] array. Since the code does not adequately check for cycles in the extent block pointers, it continues appending entries until index five is reached and exceeded. This results in a heap-based buffer overflow where memory adjacent to the stack-allocated or dynamically allocated path structure is overwritten with invalid data. The kernel's Undefined Behavior Sanitizer (UBSAN) explicitly flags this as an array-index-out-of-bounds error at fs/ocfs2/alloc.c line 677, confirming that index five is out of range for a type defined as ocfs2_path_item [5]. Such memory corruption can lead to severe consequences including kernel panics, denial of service through system crashes, or potentially arbitrary code execution if an attacker can control the data written beyond the buffer boundary.
The root cause lies in insufficient validation logic within the path-finding routine. While a previous commit identified as a406aff8c051 attempted to mitigate similar risks by restricting el->l_tree_depth to be less than OCFS2_MAX_PATH_DEPTH, it failed to account for scenarios where tree depth does not monotonically increase due to corrupted pointers creating cycles. The existing check only validates the static depth value but ignores the dynamic behavior of the traversal loop. Consequently, a crafted filesystem image can exploit this gap by forcing the algorithm into an endless descent that bypasses the intended structural constraints. This highlights a common class of vulnerabilities in file system drivers where metadata validation is incomplete regarding graph cycles and pointer integrity.
From a threat modeling perspective, this vulnerability aligns with CWE-125 Out-of-bounds Read or CWE-787 Out-of-bounds Write depending on whether subsequent reads occur after the write overflow, though the primary impact described is an out-of-bounds write via array index manipulation. In terms of MITRE ATT&CK frameworks, this flaw could be leveraged in techniques related to Privilege Escalation (T1068) if exploited for kernel code execution, or Denial of Service (T1499) through system instability. The attack vector typically involves providing a corrupted disk image or block device to the host machine, which may occur during mounting operations initiated by privileged users or potentially unprivileged users depending on mount permissions and configuration settings.
To mitigate this vulnerability, it is essential to implement robust cycle detection mechanisms within the extent tree traversal logic. Specifically, the __ocfs2_find_path function must verify that el->l_tree_depth strictly decreases with each descent step. By ensuring that every recursive or iterative call moves deeper into a uniquely identified node rather than revisiting previous nodes, the infinite loop condition is prevented. The fix restricts maximum descents to four iterations relative to the starting point, guaranteeing that path->p_node[] never exceeds its allocated size of five elements. System administrators should apply kernel updates containing this patch immediately to prevent exploitation via maliciously crafted storage media or network-mounted volumes. Regular auditing of filesystem integrity and using tools capable of detecting circular references in metadata structures can also serve as a preventive measure against such corruption-based attacks.