Skip to contentSkip to conversation

CVE-2026-68145: iomap: fix out-of-bounds bitmap_set() with zero-length range

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Aug 10

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

iomap: fix out-of-bounds bitmap_set() with zero-length range

ifs_set_range_dirty() and ifs_set_range_uptodate() compute last_blk as (off + len - 1) >> i_blkbits. When off is 0 and len is 0, the unsigned subtraction underflows to SIZE_MAX, producing a huge last_blk and nr_blks value that causes bitmap_set() to write far beyond the ifs->state allocation.

Regarding ifs_set_range_uptodate(), it is temporarily safe because len cannot be passed in as 0. However, for ifs_set_range_dirty() this is reachable from __iomap_write_end(): when copy_folio_from_iter_atomic() returns 0 (e.g. user buffer fault) and the folio is already uptodate, the guard at the top of __iomap_write_end() does not trigger because !folio_test_uptodate() is false, and iomap_set_range_dirty() is called with copied == 0.

Add a !len guard to both functions before the computation, so that a zero-length range is a no-op.

The Linux kernel CVE team has assigned CVE-2026-68145 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.6 with commit 4ce02c67972211be488408c275c8fbf19faf29b3 and fixed in 6.12.101 with commit fb4fad9105c88b1d82f1b3c39e3b6abea8249af6
	Issue introduced in 6.6 with commit 4ce02c67972211be488408c275c8fbf19faf29b3 and fixed in 6.18.42 with commit 7037e7bdcd26f46c080b8ce307dee5cb471c4b7c
	Issue introduced in 6.6 with commit 4ce02c67972211be488408c275c8fbf19faf29b3 and fixed in 7.1.6 with commit c5b6a48a8a716a7730e39af1cad083dc4ec955ce
	Issue introduced in 6.6 with commit 4ce02c67972211be488408c275c8fbf19faf29b3 and fixed in 7.2-rc5 with commit 9c7d8f7c8994c790fca501dc45ce66e7356cbe05

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-68145

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
fs/iomap/buffered-io.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/fb4fad9105c88b1d82f1b3c39e3b6abea8249af6
	https://git.kernel.org/stable/c/7037e7bdcd26f46c080b8ce307dee5cb471c4b7c
	https://git.kernel.org/stable/c/c5b6a48a8a716a7730e39af1cad083dc4ec955ce
	https://git.kernel.org/stable/c/9c7d8f7c8994c790fca501dc45ce66e7356cbe05