CVE-2026-99789: block: restore the iterator when rejecting a misaligned bio
In the Linux kernel, the following vulnerability has been resolved:
block: restore the iterator when rejecting a misaligned bio
bioiovitergetpages() 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 iterateiovec() 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Compensating control
In the Linux kernel, restore the entire iterator on the rejected-misaligned-bio path before falling back to buffered I/O; leave successful and partially accepted bio paths unchanged.
Frequently Asked Questions
What conditions are needed to trigger the issue?
The affected path involves iomap direct I/O when bio_iov_iter_get_pages() processes an iovec sequence containing a misaligned segment after it has already extracted earlier segments. The described reproducer also includes an initial empty iovec, followed by 10-byte and 1015-byte segments.
What happens when the flawed path is reached?
The rejected bio releases its pages but leaves the caller-supplied iterator advanced. If the direct-I/O caller reexpands the byte count and falls back to buffered I/O, iterate_iovec() can read beyond the imported iovec array; the reproducer produced an 8-byte out-of-bounds read reported by KASAN.
How does the fix prevent the out-of-bounds read?
The fix saves and restores the entire iterator when a misaligned bio is rejected. Restoring the complete iterator is necessary because passing an empty segment can change iterator position without consuming bytes; successful and partially accepted bio paths are unchanged.