CVE-2026-99696: ocfs2: find the xattr entry again after defragmenting a bucket
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: find the xattr entry again after defragmenting a bucket
ocfs2xattrsetentrybucket() hands loc.xlentry to ocfs2xaset() twice: once for the bucket as it stands, and, if that reports -ENOSPC, once more after ocfs2defragxattrbucket() has packed the name/value pairs down.
Defragmenting ends by sorting the entry array on xenamehash. 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.xlentry is an address inside xhentries[], so afterwards it denotes whichever entry landed in that slot rather than the one the search found.
The second ocfs2xaset() then works on the wrong entry. Nothing on that path compares the entry's name with xi->xiname, so what happens depends on how the two entries compare in size: ocfs2xareuseentry() trips its BUGON() 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 ocfs2xattrbucketfind() 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.118 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.5-1
Event History
Frequently Asked Questions
Under what conditions can this issue be triggered?
It occurs when an OCFS2 extended-attribute update initially runs out of space in an xattr bucket, causing that bucket to be defragmented before the update is retried. The affected entry must share its name hash with another entry whose position can change during the post-defragmentation sort.
What impact can a failed update have?
If the colliding entries have different padded name sizes, the kernel can hit a BUG_ON(). If their padded name sizes match, the requested value can be written to a neighbouring attribute instead, while setxattr() still reports success and the intended attribute remains unchanged.
How can administrators detect that they may already have encountered the issue?
A successful setxattr() call is not reliable evidence that the intended attribute was updated. Verify the value of the targeted attribute and, where relevant, inspect neighbouring extended attributes after updates that may have required bucket defragmentation.