CVE-2026-99696 in Linux
Summary
by MITRE • 11/20/2026
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: find the xattr entry again after defragmenting a bucket
ocfs2_xattr_set_entry_bucket() hands loc.xl_entry to ocfs2_xa_set() twice: once for the bucket as it stands, and, if that reports -ENOSPC, once more after ocfs2_defrag_xattr_bucket() has packed the name/value pairs down.
Defragmenting ends by sorting the entry array on xe_name_hash. Buckets are kept sorted, so the sort only permutes entries that share a hash, but lib/sort.c is an unstable heapsort and it does permute them. loc.xl_entry is an address inside xh_entries[], so afterwards it denotes whichever
entry landed in that slot rather than the one the search found.
The second ocfs2_xa_set() then works on the wrong entry. Nothing on that path compares the entry's name with xi->xi_name, so what happens depends on how the two entries compare in size: ocfs2_xa_reuse_entry() trips its BUG_ON() when the padded name sizes differ, and otherwise the new value is written into the neighbouring attribute's value slot while the attribute being set is left untouched. setxattr() reports success either way.
Remember the entry's hash before defragmenting and look the entry up again afterwards, the way ocfs2_xattr_bucket_find() does. An entry that cannot be found again means the bucket no longer holds what the search found, so fail with -EFSCORRUPTED rather than writing through the stale pointer.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability in question resides within the Oracle Cluster File System version two (OCFS2) implementation of the Linux kernel, specifically affecting the extended attribute handling logic during bucket defragmentation operations. Extended attributes allow files to store metadata beyond standard file system fields, and OCFS2 manages these using a structure known as buckets which contain arrays of entry descriptors. The core technical flaw arises from an improper management of memory pointers across state-changing operations within the ocfs2_xattr_set_entry_bucket function. This routine is responsible for setting or updating extended attribute entries by first attempting to locate an existing bucket and then either reusing an existing slot or allocating a new one if space permits. When insufficient space exists, the system triggers a defragmentation process designed to pack name-value pairs more tightly together to free up contiguous storage within the bucket structure.
The critical failure occurs because the function passes a direct memory address of a specific entry descriptor into subsequent helper functions before and after this defragmentation step. Specifically, the variable loc.xl_entry holds an absolute pointer to an element inside the xh_entries array. While the ocfs2_defrag_xattr_bucket routine successfully compacts the data by sorting entries based on their name hash values, it inadvertently invalidates the initial pointer reference. The underlying sorting algorithm utilized is lib/sort.c which implements a heapsort that is not stable regarding elements with equal keys. Consequently, when multiple entries share the same hash value, their relative positions within the array are permuted during the sort operation. Since loc.xl_entry remains fixed at its original memory offset rather than being updated to reflect the new position of the target entry, it now points to a different attribute entry entirely after defragmentation completes.
This pointer invalidation leads to severe logical errors in subsequent processing steps because the code proceeds to operate on the wrong extended attribute entry without verifying that the identity matches the intended target. The function ocfs2_xa_set is invoked with this stale pointer, and critically, there are no comparative checks against xi->xi_name to ensure integrity of the operation. Depending on the internal size comparison logic within ocfs2_xa_reuse_entry, two distinct failure modes emerge. In one scenario, if the padded name sizes differ between the intended entry and the erroneously targeted neighbor, a BUG_ON assertion is triggered, potentially causing a kernel panic or denial of service for the host system. in alternative scenarios where size constraints do not trigger an immediate crash, the new attribute value is written into the wrong slot belonging to a neighboring attribute while the actual target remains untouched. Despite this data corruption and logical failure, the setxattr syscall incorrectly reports success to the user space application, leading to silent data inconsistency that may only be detected later during file system checks or through unexpected behavior in applications relying on those attributes.
From a classification perspective, this vulnerability aligns with CWE-824 Access of Uninitialized Pointer and CWE-672 Use of Outside Input Without Validation as the code fails to validate that the memory location still corresponds to the expected object after structural changes. It also relates closely to CWE-362 Concurrent Execution Using Shared Resource with Improper Synchronization in a broader sense, although here the concurrency is temporal rather than multi-threaded, involving state mutation without pointer update. In terms of MITRE ATT&CK mapping, this represents an exploitation vector for Integrity Availability impact categories where attackers could potentially manipulate file system metadata or cause service disruption through crafted extended attribute operations that trigger defragmentation paths with specific hash collisions.
To mitigate this vulnerability and restore correct operational behavior, the kernel code must be patched to decouple pointer references from static array indices during mutable structures. The recommended fix involves capturing the name hash of the target entry prior to initiating any defragmentation process. After the bucket has been reorganized by ocfs2_defrag_xattr_bucket, the system should perform a fresh lookup using this stored hash value via functions like ocfs2_xattr_bucket_find rather than relying on previously computed memory addresses. If the original entry cannot be located again after sorting, it indicates that the structural integrity of the bucket has been compromised relative to the search criteria, and the operation should fail with an EFSCORRUPTED error code instead of proceeding with a stale pointer. This approach ensures that operations always target valid, current entries within the sorted array structure preventing both kernel crashes and silent data corruption in extended attribute storage mechanisms.