CVE-2026-45985: ext4: don't set EXT4_GET_BLOCKS_CONVERT when splitting before submitting I/O
In the Linux kernel, the following vulnerability has been resolved:
ext4: don't set EXT4GETBLOCKSCONVERT when splitting before submitting I/O
When allocating blocks during within-EOF DIO and writeback with dioreadnolock enabled, EXT4GETBLOCKSPREIO was set to split an existing large unwritten extent. However, EXT4GETBLOCKSCONVERT was set when calling ext4splitconvertextents(), which may potentially result in stale data issues.
Assume we have an unwritten extent, and then DIO writes the second half.
[UUUUUUUUUUUUUUUU] on-disk extent U: unwritten extent [UUUUUUUUUUUUUUUU] extent status tree |<- ->| ----> dio write this range
First, ext4iomapalloc() call ext4mapblocks() with EXT4GETBLOCKSPREIO, EXT4GETBLOCKSUNWRITEXT and EXT4GETBLOCKSCREATE flags set. ext4mapblocks() find this extent and call ext4splitconvertextents() with EXT4GETBLOCKSCONVERT and the above flags set.
Then, ext4splitconvertextents() calls ext4splitextent() with EXT4EXTMAYZEROOUT, EXT4EXTMARKUNWRIT2 and EXT4EXTDATAVALID2 flags set, and it calls ext4splitextentat() to split the second half with EXT4EXTDATAVALID2, EXT4EXTMARKUNWRIT1, EXT4EXTMAYZEROOUT and EXT4EXTMARKUNWRIT2 flags set. However, ext4splitextentat() failed to insert extent since a temporary lack -ENOSPC. It zeroes out the first half but convert the entire on-disk extent to written since the EXT4EXTDATAVALID2 flag set, but left the second half as unwritten in the extent status tree.
[0000000000SSSSSS] data S: stale data, 0: zeroed [WWWWWWWWWWWWWWWW] on-disk extent W: written extent [WWWWWWWWWWUUUUUU] extent status tree
Finally, if the DIO failed to write data to the disk, the stale data in the second half will be exposed once the cached extent entry is gone.
Fix this issue by not passing EXT4GETBLOCKSCONVERT when splitting an unwritten extent before submitting I/O, and make ext4splitconvertextents() to zero out the entire extent range to zero for this case, and also mark the extent in the extent status tree for consistency.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Disable the dioread_nolock behavior (do not enable dioread_nolock) to avoid the within-EOF DIO + writeback code path that can trigger splitting unwritten extents before submitting I/O.
ext4 dioread_nolock = disabled - Compensating control
Avoid performing within-EOF direct I/O (DIO) writes that may split unwritten extents until the kernel fix is applied. Prefer synchronous/coordinated writes or application-level file locking to prevent DIO from writing only part of an unwritten extent.
- Operational
When available from your vendor or upstream, apply the kernel patch that implements the fix: do not pass EXT4_GET_BLOCKS_CONVERT when splitting an unwritten extent before submitting I/O, and make ext4_split_convert_extents() zero out the entire extent range and mark the extent in the extent status tree for consistency.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-45985?
The severity of CVE-2026-45985 is rated as medium with a CVSS score of 5.5.
What type of vulnerability is CVE-2026-45985?
CVE-2026-45985 is a vulnerability related to the ext4 filesystem in the Linux kernel.
How do I fix CVE-2026-45985?
To fix CVE-2026-45985, ensure that the Linux kernel is updated to a version that includes the patch for this vulnerability.
Is CVE-2026-45985 exploitable?
CVE-2026-45985 can be exploited under specific conditions related to block allocation during DIO operations.
What impact does CVE-2026-45985 have on system security?
CVE-2026-45985 could lead to potential data corruption during I/O operations in the ext4 filesystem.