CVE-2026-139679: md/raid5: reject a per-device size smaller than one chunk
In the Linux kernel, the following vulnerability has been resolved:
md/raid5: reject a per-device size smaller than one chunk
Both raid5run() and raid5resize() align the per-device size down to a whole multiple of the chunk size:
mddev->devsectors &= ~(chunksectors - 1);
Neither checks the result, so a size smaller than one chunk silently becomes zero.
In raid5run() that is harmless: the array size is derived from the same zero, so the disk just ends up with no capacity.
In raid5resize() it leaves the array inconsistent -- mddev->devsectors becomes zero, while mddev->arraysectors and the gendisk capacity keep the previous. A later raid4/raid5 -> raid0 takeover copies the zero into every rdev->sectors (raid0takeoverraid45()), so createstripzones() builds a strip zone table whose zoneend is zero. Any read then passes biocheckeod() against the stale capacity and hits the BUG() in findzone():
kernel BUG at drivers/md/raid0.c:318! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI Call Trace: raid0makerequest mdhandlerequest submitbionoacctnocheck blockreadfullfolio readpartsector bdevdiskchanged bdevopen
Reject a size smaller than one chunk in both functions, so that a running raid4/raid5 array always has mddev->devsectors >= one chunk.
The check is done where the value takes effect, not where it is assigned. mddev->devsectors is written from several places, and none of them can tell whether the value is usable: the chunk size may still change later. raid5run() and raid5resize() are where every input is final, so one check in each covers them all.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In Linux MD, reject per-device sizes smaller than one chunk in both raid5_run() and raid5_resize(), checking where the aligned value takes effect.
Event History
Frequently Asked Questions
What configuration is required to trigger the kernel BUG?
The affected RAID4/RAID5 array must be resized so that its per-device size is smaller than one chunk, causing the aligned per-device size to become zero. The array must then undergo a RAID4/RAID5-to-RAID0 takeover; subsequent reads can reach the BUG in raid0's find_zone().
Is creating or starting an array with a per-device size smaller than one chunk equally dangerous?
No. In raid5_run(), the zero per-device size also produces a zero-capacity array, which the description identifies as harmless. The inconsistent state arises specifically when raid5_resize() zeros mddev->dev_sectors while retaining the prior array and disk capacity.
What is the practical impact if the vulnerable sequence occurs?
A read against the resulting RAID0 array can trigger a kernel BUG at drivers/md/raid0.c:318, producing an invalid-opcode oops. This can cause a system crash or loss of availability.
What should administrators avoid before applying the fix?
Do not resize RAID4/RAID5 arrays to a per-device size smaller than the configured chunk size, particularly if a later takeover to RAID0 is planned. Avoid performing the RAID4/RAID5-to-RAID0 takeover on an array that has undergone such a resize.