CRITICAL
ext4 BlockGroup Overflow
CVE-2026-43067
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.3HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: ext4: handle wraparound when searching for blocks for indirect mapped blocks Commit 4865c768b563 ("ext4: always allocate blocks only from groups inode can use") restricts what blocks will be allocated for indirect block based files to block numbers that fit within 32-bit block numbers. However, when using a review bot running on the latest Gemini LLM to check this commit when backporting into an LTS based kernel, it raised this concern: If ac->ac_g_ex.fe_group is >= ngroups (for instance, if the goal group was populated via stream allocation from s_mb_last_groups), then start will be >= ngroups. Does this allow allocating blocks beyond the 32-bit limit for indirect block mapped files? The commit message mentions that ext4_mb_scan_groups_linear() takes care to not select unsupported groups. However, its loop uses group = *start, and the very first iteration will call ext4_mb_scan_group() with this unsupported group because next_linear_group() is only called at the end of the iteration. After reviewing the code paths involved and considering the LLM review, I determined that this can happen when there is a file system where some files/directories are extent-mapped and others are indirect-block mapped. To address this, add a safety clamp in ext4_mb_scan_groups().
02KernelScan AI Analysis
Risk summary
Local users can trigger an out-of-bounds access in ext4's block allocator by causing an invalid block group index to be used during allocation for indirect-mapped files. This leads to out-of-bounds reads of kernel heap data (information leak), potential filesystem metadata corruption from allocating blocks beyond valid ranges, and system instability or kernel panic.
Vulnerability analysis
The vulnerability occurs in ext4's mballoc block allocator when the starting group number (ac->ac_g_ex.fe_group) is not validated against the total number of block groups (ngroups). In mixed filesystems with both extent-mapped and indirect-mapped files, stream allocation can populate the goal group from s_mb_last_groups with a value exceeding ngroups. Without validation, this invalid index is used to access per-group data structures on the first iteration of ext4_mb_scan_groups_linear(), resulting in an out-of-bounds read. If allocation proceeds, it may select blocks from invalid groups, causing filesystem metadata corruption for indirect-mapped files that require 32-bit block numbers. The fix adds a bounds check that clamps the starting group to 0 when it exceeds ngroups.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 5.16 | 5.16 | f89bba144938 |
| 6.1 | 6.1.168 | 83170a05908b |
| 6.12 | 6.12.80 | 12624c5b724a |
| 6.18 | 6.18.21 | 2a368ccddfc4 |
| 6.19 | 6.19.11 | bb81702370fa |
| 6.6 | 6.6.134 | 4bec4a498ce8 |