CVE-2026-99789: block: restore the iterator when rejecting a misaligned bio
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
block: restore the iterator when rejecting a misaligned bio
bio_iov_iter_get_pages() can extract some iovecs before encountering a misaligned one. It releases the pages and rejects the entire bio, but leaves the supplied iterator advanced.
An iomap direct-I/O caller may subsequently reexpand the iterator's byte count and fall back to buffered I/O. The reexpanded count then includes bytes before the iterator's current segment, potentially causing iterate_iovec() to read beyond the imported iovec array.
In a reproducer using an initial empty iovec followed by 10-byte and 1015-byte segments, writev() returned 1015 instead of 1025 and KASAN reported an 8-byte read beyond the nine-element iovec allocation. Saving and restoring the iterator on the rejected-bio path makes writev() return 1025 and eliminates the KASAN report.
Restore the entire iterator rather than reverting a byte count:
advancing past an empty segment changes its position without consuming any bytes.
Leave successful and partially accepted bio paths unchanged.
The Linux kernel CVE team has assigned CVE-2026-99789 to this issue.
Affected and fixed versions
===========================
Issue introduced in 7.3 with commit 14b007e178811db72fbb1ebb3535160db6ec1e6a and fixed in 7.3.5 with commit 3a6381f254ed81d36f3896f61dcd5d830e08861d Issue introduced in 7.3 with commit 14b007e178811db72fbb1ebb3535160db6ec1e6a and fixed in 7.4-rc1 with commit 40d070cbb1906896d6fd65c39722d2411830ed9f Issue introduced in 7.2.4 with commit d44a97a3b1c00cc571245124e23e5ceb0a0225a0
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-99789
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:
block/bio.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/3a6381f254ed81d36f3896f61dcd5d830e08861d https://git.kernel.org/stable/c/40d070cbb1906896d6fd65c39722d2411830ed9f