CVE-2026-99966: ocfs2: reserve metadata for a new xattr block and its value tree
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: reserve metadata for a new xattr block and its value tree
Patch series "ocfs2: fix metadata reservation for xattr value trees".
ocfs2calcxattrsetneed() reserves too little metadata for a new xattr value's extent tree on three paths. The reservation cannot be topped up once the transaction has started, so ocfs2addclustersinbtree() gives up with RESTARTMETA when the value root fills and nothing is left. ocfs2xattrextendallocation() turns that into -ENOSPC, after ocfs2xacleanupvaluetruncate() has dropped the entry and leaked the clusters already handed out; before commit 0cdc7dde00ec ("ocfs2: fix missing metadata reservation for large xattrs") it was a BUGON() instead. It takes a fragmented cluster allocator to get there, since the first extent always fits in the root.
Patch 1 fixes the create side of metaguess: commit 3ed2be719eb9 ("ocfs2: allow for more than one data extent when creating xattr") replaced the block reserved for the new xattr block with the two the value tree needs instead of adding them together.
Patch 2 fixes the arm that moves an xattr back into the inode, which charges credits for a value tree but no metadata for one.
Patch 3 drops a second copy of the same reservation on the path that falls through to metaguess. That one is cleanup rather than a fix and is not for stable, and it must not be backported without patch 1: the duplicate it removes is what currently covers the shortfall patch 1 fixes.
This patch (of 3):
The create side of metaguess in ocfs2calcxattrsetneed() reserves metadata for the new value's extent tree and nothing for the xattr block that will hold it:
} else { credits += OCFS2XATTRBLOCKCREATECREDITS; if (xi->xivaluelen > OCFS2XATTRINLINESIZE) { struct ocfs2extentlist el = &defxv.xv.xrlist; metaadd += ocfs2extendmetaneeded(el); ...
Commit 3ed2be719eb9 ("ocfs2: allow for more than one data extent when creating xattr") meant to add that tree on top of the metaadd += 1 the branch already had, but it moved the 1 into the else arm instead, so the external-value case lost it. The 1 is not optional: it is what ocfs2createxattrblock() takes from metaac through ocfs2claimmetadata(), and it is spent before the value tree exists.
ocfs2extendmetaneeded() on the empty defxv list returns 2, so the branch reserves 2 where 3 are needed. The xattr block consumes one, and when the cluster allocator is fragmented enough that the value needs more than one extent, ocfs2addclustersinbtree() comes back around with a full value root and ocfs2alloccontextbitsleft() of 1 against a threshold of 2. It answers RESTARTMETA, which ocfs2xattrextendallocation() turns into a BUGON(). Commit 0cdc7dde00ec ("ocfs2: fix missing metadata reservation for large xattrs") downgraded that to -ENOSPC, at the cost of leaking the clusters already handed out: ocfs2xacleanupvaluetruncate() takes its !origclusters arm, drops the entry and leaves the clusters for fsck.ocfs2 to reclaim.
Reserve for the block and the tree separately.