CVE-2026-139682: md/raid5: don't BUG() on an inconsistent reshape state from the superblock
In the Linux kernel, the following vulnerability has been resolved:
md/raid5: don't BUG() on an inconsistent reshape state from the superblock
raid5run() branches on mddev->reshapeposition. When it is MaxSector -- no reshape in progress -- the else branch asserts that nothing else describes one:
BUGON(mddev->level != mddev->newlevel); BUGON(mddev->layout != mddev->newlayout); BUGON(mddev->chunksectors != mddev->newchunksectors); BUGON(mddev->deltadisks != 0);
Nothing enforces that invariant. Both superblock validators copy the reshape fields straight off disk without cross-checking them against each other: super1validate() takes reshapeposition, deltadisks, newlevel, newlayout and newchunk from the superblock whenever MDFEATURERESHAPEACTIVE is set, and super90validate() does the same for minor version 91. A superblock that sets the reshape feature while leaving reshapeposition at the MaxSector sentinel therefore reaches the else branch with a non-zero deltadisks, and assembling the array takes the machine down:
kernel BUG at drivers/md/raid5.c:8117! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:raid5run+0x11a7/0x1670 drivers/md/raid5.c:8117 Call Trace: mdrun+0xc2f/0x2510 drivers/md/md.c:6779 domdrun+0x36/0x660 drivers/md/md.c:6880 arraystatestore+0x9c5/0xcf0 drivers/md/md.c:4765 mdattrstore+0x1c5/0x330 drivers/md/md.c:6158 sysfskfwrite+0xf2/0x150 fs/sysfs/file.c:145 kernfsfopwriteiter+0x3e0/0x5f0 fs/kernfs/file.c:345
This is reachable by anyone who can present an md superblock, so BUG() is the wrong response. Refuse to start the array instead, the way the reshapeposition != MaxSector branch a few lines above already refuses a reshape it cannot resume. Nothing has been allocated at this point -- the journal-and-bitmap check just above returns -EINVAL the same way -- so there is nothing to unwind.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Refuse to start the array when the superblock contains an inconsistent reshape state, such as a nonzero delta_disks with reshape_position at the MaxSector sentinel.
Event History
Frequently Asked Questions
Which systems are exposed to the crash condition?
Linux systems that assemble an md RAID5 array are exposed when the array uses a version 1 superblock, or a version 0.90 superblock with minor version 91, containing inconsistent reshape metadata. The relevant state has the reshape feature marked active while reshape_position remains the MaxSector no-reshape sentinel.
What happens when the affected metadata is encountered?
During array assembly, raid5_run() can reach a BUG_ON assertion because reshape-related fields still describe a reshape despite reshape_position indicating that none is in progress. This causes a kernel BUG and invalid-opcode Oops, taking the machine down.
How can an administrator identify an array with the triggering state?
Check the on-disk md superblock reshape fields. The triggering condition is an active reshape feature with reshape_position set to MaxSector, together with inconsistent reshape values such as a nonzero delta_disks or differing new level, layout, or chunk settings.