{"id":"CVE-2026-138817","summary":"iomap: don't lose a fiemap iteration error when emitting the last extent","details":"In the Linux kernel, the following vulnerability has been resolved:\n\niomap: don't lose a fiemap iteration error when emitting the last extent\n\niomap_fiemap() emits extents one behind: iomap_fiemap_iter() flushes the\nprevious extent and remembers the current one, and the remembered extent\nis written with FIEMAP_EXTENT_LAST after the iteration loop.\n\nThat final flush overwrites ret, so when -\u003eiomap_begin() fails partway\nthrough the iteration the error is replaced by the result of\niomap_to_fiemap() (zero on success) and iomap_fiemap() returns success\nwith a truncated extent list whose last entry is wrongly marked as the\nlast extent in the file.  The pre-iomap_iter code returned the error\nfrom inside the loop, before flushing the pending extent.\n\nCheck for the iteration error before flushing the pending extent, so\nthat real errors are propagated and only a successful iteration emits\nthe final FIEMAP_EXTENT_LAST extent.  -ENOENT (no mapping) is still not\nan error, and the pending extent is still emitted in that case.","modified":"2026-12-01T21:02:34.464426364Z","published":"2026-11-30T13:25:15.605Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138817.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/0d0104adc2c8316433b660cdf6d182a09881864f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/29d93cc25328ec27d34098c722ef837778612dd7"},{"type":"WEB","url":"https://git.kernel.org/stable/c/512d832beec8d2487e058befb90258e2bce89319"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5d6f21538389fa2b9fa143afdebb4cbe170ec900"},{"type":"WEB","url":"https://git.kernel.org/stable/c/635bacc0c05d369a0bea6855b354aa08cc0ab690"},{"type":"WEB","url":"https://git.kernel.org/stable/c/904e6876bb9924c8ce8eb83786c68e6404bdb042"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d6c4a5d2cc6ad695bdc89ce6ac028eac17484b9a"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138817.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138817"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"7892386d35715d14c469ec98b6deab037e2e2232"},{"fixed":"904e6876bb9924c8ce8eb83786c68e6404bdb042"},{"fixed":"635bacc0c05d369a0bea6855b354aa08cc0ab690"},{"fixed":"29d93cc25328ec27d34098c722ef837778612dd7"},{"fixed":"512d832beec8d2487e058befb90258e2bce89319"},{"fixed":"d6c4a5d2cc6ad695bdc89ce6ac028eac17484b9a"},{"fixed":"5d6f21538389fa2b9fa143afdebb4cbe170ec900"},{"fixed":"0d0104adc2c8316433b660cdf6d182a09881864f"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138817.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.15.0"},{"fixed":"5.15.226"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.193"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.117"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.63"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138817.json"}}],"schema_version":"1.9.2"}