{"id":"CVE-2026-139438","state":"PUBLISHED","title":"block: use iomap_dirty_folio for block devices","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nblock: use iomap_dirty_folio for block devices\n\nWith CONFIG_BUFFER_HEAD=n, block devices are written back through iomap,\nbut def_blk_aops uses filemap_dirty_folio, which only sets PG_dirty. It\ndoes not set the per-block dirty bits in the folio's iomap_folio_state,\nso iomap_writeback_folio() finds no dirty range, submits no I/O and\nclears PG_dirty, resulting in data loss.\n\nOther iomap users set .dirty_folio to iomap_dirty_folio, which marks the\nfolio's blocks dirty before calling filemap_dirty_folio().\n\nThis is only observable with block size < folio size. With a single\nblock there is no iomap_folio_state to get out of sync and\niomap_writeback_folio() marks the whole folio dirty itself. For a\npage-aligned device, this may require using the BLKBSZSET ioctl to set\nthe block size, which requires CAP_SYS_ADMIN. A device whose size is not\npage aligned already gets a sub-page block size from\nset_init_blocksize(), so no ioctl and no privilege is needed.\n\nTo reproduce, on a device with a sub-page block size, write a known\npattern with O_DIRECT, mmap the same range, store to it, msync() and\nfsync(), then read it back with O_DIRECT. A reproducer is available at\n[1].\n\n[1] https://gist.github.com/tzussman/18ab05cba4b3fdc79cce0a69d1fd05b4","publishedAt":"2026-11-30T13:34:45.484Z","updatedAt":"2026-11-30T13:34:45.484Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"6d6239c59c38a1743abd835f97ba032dc1db943f","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"ee52ddbd70de6538262c29466a49a1f1b875aac5","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"f2ee24d9e70b21d078273eac11a7b84aef7c3b78","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"2c163c18e8e2adf2f9ed865275ddcf50773e388a","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"be1e33eda3e6699e57ed3fe6e34078f115b4a1ec","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["block/fops.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["block/fops.c"]}],"references":["https://git.kernel.org/stable/c/6d6239c59c38a1743abd835f97ba032dc1db943f","https://git.kernel.org/stable/c/ee52ddbd70de6538262c29466a49a1f1b875aac5","https://git.kernel.org/stable/c/f2ee24d9e70b21d078273eac11a7b84aef7c3b78","https://git.kernel.org/stable/c/2c163c18e8e2adf2f9ed865275ddcf50773e388a","https://git.kernel.org/stable/c/be1e33eda3e6699e57ed3fe6e34078f115b4a1ec"],"weaknesses":[],"ingestedAt":"2026-11-30T13:50:04.417Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139438.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139438","state":"PUBLISHED","datePublished":"2026-11-30T13:34:45.484Z","dateUpdated":"2026-11-30T13:34:45.484Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.933Z"},"containers":{"cna":{"title":"block: use iomap_dirty_folio for block devices","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nblock: use iomap_dirty_folio for block devices\n\nWith CONFIG_BUFFER_HEAD=n, block devices are written back through iomap,\nbut def_blk_aops uses filemap_dirty_folio, which only sets PG_dirty. It\ndoes not set the per-block dirty bits in the folio's iomap_folio_state,\nso iomap_writeback_folio() finds no dirty range, submits no I/O and\nclears PG_dirty, resulting in data loss.\n\nOther iomap users set .dirty_folio to iomap_dirty_folio, which marks the\nfolio's blocks dirty before calling filemap_dirty_folio().\n\nThis is only observable with block size < folio size. With a single\nblock there is no iomap_folio_state to get out of sync and\niomap_writeback_folio() marks the whole folio dirty itself. For a\npage-aligned device, this may require using the BLKBSZSET ioctl to set\nthe block size, which requires CAP_SYS_ADMIN. A device whose size is not\npage aligned already gets a sub-page block size from\nset_init_blocksize(), so no ioctl and no privilege is needed.\n\nTo reproduce, on a device with a sub-page block size, write a known\npattern with O_DIRECT, mmap the same range, store to it, msync() and\nfsync(), then read it back with O_DIRECT. A reproducer is available at\n[1].\n\n[1] https://gist.github.com/tzussman/18ab05cba4b3fdc79cce0a69d1fd05b4"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"6d6239c59c38a1743abd835f97ba032dc1db943f","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"ee52ddbd70de6538262c29466a49a1f1b875aac5","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"f2ee24d9e70b21d078273eac11a7b84aef7c3b78","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"2c163c18e8e2adf2f9ed865275ddcf50773e388a","versionType":"git"},{"version":"925c86a19bacf8ce10eb666328fb3fa5aff7b951","status":"affected","lessThan":"be1e33eda3e6699e57ed3fe6e34078f115b4a1ec","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["block/fops.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["block/fops.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/6d6239c59c38a1743abd835f97ba032dc1db943f"},{"url":"https://git.kernel.org/stable/c/ee52ddbd70de6538262c29466a49a1f1b875aac5"},{"url":"https://git.kernel.org/stable/c/f2ee24d9e70b21d078273eac11a7b84aef7c3b78"},{"url":"https://git.kernel.org/stable/c/2c163c18e8e2adf2f9ed865275ddcf50773e388a"},{"url":"https://git.kernel.org/stable/c/be1e33eda3e6699e57ed3fe6e34078f115b4a1ec"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:34:45.484Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}