# CVE-2026-138817: iomap: don't lose a fiemap iteration error when emitting the last extent

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.17%, higher than 7% of CVEs (2026-12-01)
- Published: 2026-11-30T13:25:15.605Z
- Modified: 2026-11-30T14:17:35.623Z
- Assigned by: Linux

## Description

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

iomap: don't lose a fiemap iteration error when emitting the last extent

iomap_fiemap() emits extents one behind: iomap_fiemap_iter() flushes the
previous extent and remembers the current one, and the remembered extent
is written with FIEMAP_EXTENT_LAST after the iteration loop.

That final flush overwrites ret, so when ->iomap_begin() fails partway
through the iteration the error is replaced by the result of
iomap_to_fiemap() (zero on success) and iomap_fiemap() returns success
with a truncated extent list whose last entry is wrongly marked as the
last extent in the file.  The pre-iomap_iter code returned the error
from inside the loop, before flushing the pending extent.

Check for the iteration error before flushing the pending extent, so
that real errors are propagated and only a successful iteration emits
the final FIEMAP_EXTENT_LAST extent.  -ENOENT (no mapping) is still not
an error, and the pending extent is still emitted in that case.

(As written by CVE List.)

## Affected

- Linux Linux: from 7892386d35715d14c469ec98b6deab037e2e2232 before 904e6876bb9924c8ce8eb83786c68e6404bdb042; from 7892386d35715d14c469ec98b6deab037e2e2232 before 635bacc0c05d369a0bea6855b354aa08cc0ab690; from 7892386d35715d14c469ec98b6deab037e2e2232 before 29d93cc25328ec27d34098c722ef837778612dd7; from 7892386d35715d14c469ec98b6deab037e2e2232 before 512d832beec8d2487e058befb90258e2bce89319; from 7892386d35715d14c469ec98b6deab037e2e2232 before d6c4a5d2cc6ad695bdc89ce6ac028eac17484b9a; from 7892386d35715d14c469ec98b6deab037e2e2232 before 5d6f21538389fa2b9fa143afdebb4cbe170ec900; from 7892386d35715d14c469ec98b6deab037e2e2232 before 0d0104adc2c8316433b660cdf6d182a09881864f; 5.15 (not affected: before 5.15; from 5.15.226 up to 5.15.*; from 6.1.193 up to 6.1.*; from 6.6.163 up to 6.6.*; from 6.12.117 up to 6.12.*; from 6.18.63 up to 6.18.*; from 7.3.4 up to 7.3.*; from 7.4-rc1 up to *)

## References

- <https://git.kernel.org/stable/c/904e6876bb9924c8ce8eb83786c68e6404bdb042>
- <https://git.kernel.org/stable/c/635bacc0c05d369a0bea6855b354aa08cc0ab690>
- <https://git.kernel.org/stable/c/29d93cc25328ec27d34098c722ef837778612dd7>
- <https://git.kernel.org/stable/c/512d832beec8d2487e058befb90258e2bce89319>
- <https://git.kernel.org/stable/c/d6c4a5d2cc6ad695bdc89ce6ac028eac17484b9a>
- <https://git.kernel.org/stable/c/5d6f21538389fa2b9fa143afdebb4cbe170ec900>
- <https://git.kernel.org/stable/c/0d0104adc2c8316433b660cdf6d182a09881864f>

## Sources

- CVE List: [CVE-2026-138817](https://www.cve.org/CVERecord?id=CVE-2026-138817), CVE Terms of Use, modified 2026-11-30
- NVD: [CVE-2026-138817](https://nvd.nist.gov/vuln/detail/CVE-2026-138817), Public domain, modified 2026-11-30

---

Page: https://cve.day/CVE-2026-138817 · Whole record: https://cve.day/CVE-2026-138817.json · Rebuilt by cve.day 2026-11-30T14:32:25.555Z
