CVE-2026-138889: ocfs2: restrict OCFS2_INVALID_SLOT suballoc slot to system inodes
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: restrict OCFS2INVALIDSLOT suballoc slot to system inodes
Patch series "ocfs2: validate suballoc slot and bit of metadata blocks", v3.
The ocfs2 metadata validators trust the on-disk suballoc slot and bit without checking them against the slot range of the mounted filesystem and the capacity of the block group bitmap. A corrupted image can carry OCFS2INVALIDSLOT or another out-of-range slot, or a suballoc bit beyond the bitmap, and once the corresponding inode, extent block, xattr block, dir index root or refcount block gets freed, the bad value goes straight into ocfs2getsystemfileinode() or ocfs2freesuballocbits() and hits a BUGON() or runs off the end of localsysteminodes[].
This series rejects such values at read time, in the existing validators, so corrupted objects fail with -EROFS (and a read-only remount) instead of crashing:
patch 1 restricts OCFS2INVALIDSLOT dinodes to system inodes, completing fe7a283b3916 ("ocfs2: add suballoc slot check in ocfs2validateinodeblock()"), and turns the "system file state is ambiguous" BUGON() in ocfs2readlockedinode() into an ocfs2error(); patch 2 rejects oversized dinode suballoc bits; patch 3 validates the suballoc slot and bit of xattr and dir index blocks; patch 4 validates the suballoc slot and bit of extent and refcount blocks.
The checks only enforce what the kernel and mkfs.ocfs2 already write: a valid slot from metaac->acallocslot and a bit within the block group bitmap, with system inodes carrying OCFS2INVALIDSLOT plus OCFS2SYSTEMFL and extent blocks using slot 0. Nothing changes for healthy filesystems.
Each new check was exercised under QEMU by corrupting the field in question with an out-of-range value; with the series applied the access fails with -EROFS and the filesystem remounts read-only instead of hitting the BUGON().
This patch (of 4):
ocfs2validateinodeblock() currently permits isuballocslot to be OCFS2INVALIDSLOT for any dinode. Only system inodes created by mkfs.ocfs2 are allocated from the global allocator and thus legitimately carry this value; regular inodes are always allocated from a per-slot suballocator and hence must have a valid slot.
If a corrupted regular inode with OCFS2INVALIDSLOT is accepted, ocfs2removeinode() will pass the slot to ocfs2getsystemfileinode() and getlocalsysteminode() will hit BUGON(slot == OCFS2INVALIDSLOT) when the inode is deleted. This can be triggered by an unprivileged user unlinking such a corrupted file.
Reject OCFS2INVALIDSLOT for non-system dinodes during validation, while still accepting it for system inodes. Note that a crafted dinode carrying OCFS2SYSTEMFL passes the check above, yet a plain lookup of it still used to BUG() in ocfs2readlockedinode() ("system file state is ambiguous"). Since iflags comes from disk, handle that mismatch with ocfs2error() instead of BUGON() as well.
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.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - 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.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1Fixed in 7.3.4-1
Event History
Frequently Asked Questions
What conditions are required to trigger this issue?
The mounted OCFS2 filesystem must contain corrupted metadata with an invalid suballocator slot or a suballocator bit beyond the block-group bitmap capacity. The affected metadata object must then be freed, which can cause a BUG_ON() or an out-of-bounds access to local_system_inodes[].
Are normal user files affected by OCFS2_INVALID_SLOT values?
OCFS2_INVALID_SLOT is intended only for system inodes. A corrupted image that assigns it to other inode types is part of the condition addressed by the fix.
What happens after the fix detects malformed OCFS2 metadata?
The validators reject the corrupted object when it is read. The filesystem reports -EROFS and remounts read-only rather than proceeding to a kernel crash or out-of-bounds access.
How can administrators identify potential exposure?
Exposure depends on mounting an OCFS2 image with corrupted metadata, particularly invalid suballocator slot or bitmap-bit values. The provided information does not identify a non-invasive detection method before the affected metadata is read or freed.