HIGH
lib/scatterlist Iterator Length OOB
CVE-2026-46289
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: lib/scatterlist: fix length calculations in extract_kvec_to_sg Patch series "Fix bugs in extract_iter_to_sg()", v3. Fix bugs in the kvec and user variants of extract_iter_to_sg. This series is growing due to useful remarks made by sashiko.dev. The main bugs are: - The length for an sglist entry when extracting from a kvec can exceed the number of bytes in the page. This is obviously not intended. - When extracting a user buffer the sglist is temporarily used as a scratch buffer for extracted page pointers. If the sglist already contains some elements this scratch buffer could overlap with existing entries in the sglist. The series adds test cases to the kunit_iov_iter test that demonstrate all of these bugs. Additionally, there is a memory leak fix for the test itself. The bugs were orignally introduced into kernel v6.3 where the function lived in fs/netfs/iterator.c. It was later moved to lib/scatterlist.c in v6.5. Thus the actual fix is only marked for backports to v6.5+. This patch (of 5): When extracting from a kvec to a scatterlist, do not cross page boundaries. The required length was already calculated but not used as intended. Adjust the copied length if the loop runs out of sglist entries without extracting everything. While there, return immediately from extract_iter_to_sg if there are no sglist entries at all. A subsequent commit will add kunit test cases that demonstrate that the patch is necessary.
02KernelScan AI Analysis
Risk summary
A length calculation error in kernel iterator-to-scatterlist conversion can cause out-of-bounds memory access. Systems using network filesystems or other iterator-based operations are at risk of information disclosure, memory corruption, and potential system crashes.
Vulnerability analysis
The extract_kvec_to_sg function incorrectly used the total remaining length instead of the page-bounded segment length when setting up scatter-gather list entries. This causes entries to claim they contain more data than actually fits within page boundaries, leading to out-of-bounds access during subsequent DMA operations or memory transfers. Depending on how the scatterlist is consumed, the incorrect length can result in out-of-bounds reads (information leak from adjacent kernel memory) or out-of-bounds writes (memory corruption). The fix ensures proper length calculations and adds bounds checking for scatter-gather list capacity.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.12 | 6.12.88 | e5e22fc99634 |
| 6.18 | 6.18.30 | 8fbba6829057 |
| 6.6 | 6.6.140 | 3f17500e86d7 |
| 7.0 | 7.0.7 | 9d38756d0a93 |
| mainline | 7.1-rc1 | 07b7d66e65d9 |