CVE-2026-138991: md: validate bblog_size when loading v1.x badblocks metadata
In the Linux kernel, the following vulnerability has been resolved:
md: validate bblogsize when loading v1.x badblocks metadata
In super1load(), when the on-disk featuremap does not have MDFEATUREBADBLOCKS set but sb->bblogoffset is non-zero, rdev->badblocks.shift is initialized to 0 without validating sb->bblogsize. The same field is validated in the MDFEATUREBADBLOCKS branch ("sectors > (PAGESIZE / 512)"), but this branch bypasses that check.
A forged on-disk superblock (malicious storage device or crafted image) can therefore carry an oversized sb->bblogsize. When bad blocks are later recorded, super1sync() sets bb->size from sb->bblogsize and mdwritemetadata() issues a bio larger than the single rdev->bbpage, reading beyond the page and leaking kernel memory contents to disk.
sb->bblogsize is never modified by the kernel between load and sync, and the MDFEATUREBADBLOCKS branch already validates it, so checking it in this branch is sufficient to cover both paths.
Fix this by rejecting an oversized sb->bblogsize with -EINVAL, matching the existing check in the MDFEATUREBADBLOCKS branch.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - 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.117 - 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.117-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.117-1Fixed in 7.3.4-1 - Compensating control
In the Linux kernel's super_1_load(), reject an oversized sb->bblog_size with -EINVAL when MD_FEATURE_BAD_BLOCKS is not set but sb->bblog_offset is non-zero.
Event History
Frequently Asked Questions
What systems are realistically exposed to this issue?
Systems that load v1.x MD RAID metadata from a malicious storage device or a crafted image are exposed if the superblock has a nonzero bblog_offset, lacks the MD_FEATURE_BAD_BLOCKS feature flag, and contains an oversized bblog_size.
What must happen for kernel memory to be leaked?
The forged metadata must be loaded first, and bad blocks must later be recorded. During metadata synchronization, the kernel can write more data than fits in the single bad-blocks page, causing memory beyond that page to be written to disk.
How can administrators identify affected on-disk metadata?
Inspect v1.x MD superblocks for a nonzero bblog_offset while MD_FEATURE_BAD_BLOCKS is not set, then check whether bblog_size exceeds PAGE_SIZE / 512 sectors. The fixed kernel rejects such metadata with -EINVAL when loading it.
What can be done before applying the fix?
Do not attach or assemble untrusted MD arrays, storage devices, or crafted disk images that may contain forged v1.x MD superblocks. Avoid actions that record bad blocks on arrays whose metadata cannot be trusted.