CVE-2026-138874: ext4: don't report delalloc data as a hole on indirect-mapped inodes

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

ext4: don't report delalloc data as a hole on indirect-mapped inodes

When a plain lookup finds no block, ext4indmapblocks() sizes the hole it reports by counting the empty subtrees under 'partial' in the on-disk indirect tree. That count knows nothing about delayed allocation, so a range holding delalloc data that has not been written back yet is reported as a plain hole. The extent-mapped path does not have this problem: it trims the hole it found at the first delayed extent before returning it.

ext4mapblocks() consults the extent status tree before it calls into the mapping layer, so a query that starts exactly on the delayed block still finds it. A query that starts earlier does not, because the hole reported for the earlier block already spans the delayed one. On a 4k-block filesystem, lseek(SEEKDATA) from offset 0 on a file whose only data block is at logical block N and is still dirty returns:

N = 0..11 direct blocks N << 12 N = 12 first single-indirect block N << 12 N = 13..1035 inside that indirect block -1 ENXIO N = 1036 first double-indirect block N << 12

Blocks 12 and 1036 survive because the query lands on the delayed block itself. Blocks 13..1035 are swallowed by the 1024-block hole reported for block 12. fiemap loses the same data for the same reason.

An ext3 filesystem mounted as ext4 hits this during ordinary use: ext3 inodes stay indirect mapped, while mount -t ext4 turns on delayed allocation even though mounting ext3 with -o delalloc is explicitly rejected. install(1) from coreutils uses SEEKDATA to locate data in its source file, so installing a sparse file that has not been written back silently produces a destination of the right size holding none of the data:

truncate -s 1G img && mkfs.ext3 -F img && mount -t ext4 img mnt echo | dd of=mnt/src bs=1 count=1 seek=64K install mnt/src mnt/dst cmp mnt/src mnt/dst # differ: char 65537

Reconciling a hole with the extent status tree does not depend on how the hole was found, so instead of open coding it a second time, split the delalloc handling out of ext4extdetermineinserthole() into ext4determineinserthole(), which takes the hole the caller located, and call that from ext4indmapblocks() as well. All the special cases and the comments explaining them stay in one place.

Two things change for indirect-mapped inodes. They now cache the holes they report, as the extent-mapped path already does: ext4punchhole() already puts EXTENTSTATUSHOLE on such inodes, ext4mapblocks() and ext4damapblocks() already handle a cached hole, the latter by replacing it with the delayed extent, and consecutive hole entries merge, so the tree does not grow with the length of a scan. And when a delayed extent covers the queried block itself - a race, since ext4mapblocks() found nothing in the tree just before - the hole is now reported only up to the end of that extent instead of in full.

The indirect path passes holestart == lblk, so the "delalloc extent in front of the queried range" case cannot be reached there: estreesearch() never returns an extent ending before the block it was searched for.

With this the sweep above returns N << 12 for every N, while the nodelalloc and extent-mapped controls are unchanged. generic/225, generic/285, generic/448 and generic/490 pass on ext4 made both with and without the extent feature. generic/286 and generic/436 pass on extent-mapped ext4 and are skipped without it, since they need fallocate.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:25 PM
Data Sourced
via MITRE·01:25 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203