CVE-2026-138872: ext4: fix out-of-bounds read in ext4_get_group_info()
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix out-of-bounds read in ext4getgroupinfo()
A plain read of sgroupscount in ext4getgroupinfo() allows CPU load-load reordering. On weak memory models, speculative prefetch of sgroupinfo prior to the boundary check could lead to an out-of-bounds read if a concurrent online resize expands the array and increments sgroupscount.
The data race occurs between the ioctl configuration path (holding the resize lock via ext4resizebegin) and the lockless metadata lookup path:
CPU 0 (Writer, Resize Lock) CPU 1 (Reader, Lockless) --------------------------- ------------------------ ext4ioctl() [EXT4IOCGROUPADD] ext4ioctlgroupadd() ext4resizebegin() // Takes lock ext4groupadd() ext4mballocgroupinfo() // Publishes expanded array via RCU rcuassignpointer(sgroupinfo, ...)
ext4flexgroupadd() ext4updatesuper() ext4getgroupinfo() // Speculative / out-of-order read [Loads old/smaller sgroupinfo pointer] [Plain C store / smpwmb()] sbi->sgroupscount += ...; // Reads new sgroupscount, // boundary check passes if (group >= sgroupscount)
// Out-of-bounds array access! sbiarrayrcuderef(..., sgroupinfo)
Fix this by using ext4getgroupscount() to enforce acquire semantics.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In ext4_get_group_info(), use ext4_get_groups_count() to enforce acquire semantics when reading s_groups_count.
Event History
Frequently Asked Questions
What conditions are required for this issue to occur?
The affected ext4 filesystem must undergo a concurrent online resize that expands the group-info array while another CPU performs a lockless metadata lookup. The problematic ordering is described for weak memory models, where the reader can observe a new group count with an old, smaller array pointer.
Which resize operation is involved in the race?
The writer side is the ioctl configuration path using EXT4_IOC_GROUP_ADD. It takes the resize lock, publishes an expanded s_group_info array through RCU, and then increases s_groups_count while lockless readers may still observe stale array state.