CVE-2026-46289
JSON

9.8critical

lib/scatterlist: fix length calculations in extract_kvec_to_sg

Severity
9.8critical CVSS:3.1 by Linux
Exploit likelihood
0.46% (higher than 41% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

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.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 0185846975339a5c348373aa450a977f5242366b before 3f17500e86d730c76db638bb3ae52f9b5e496c76, from 0185846975339a5c348373aa450a977f5242366b before e5e22fc9963469e678c4f4bb38d26adcec107f1e, from 0185846975339a5c348373aa450a977f5242366b before 8fbba6829057979149d1b37d65690c037f3ddf4d, from 0185846975339a5c348373aa450a977f5242366b before 9d38756d0a93b66163554219fa9c3365f40c4035, from 0185846975339a5c348373aa450a977f5242366b before 07b7d66e65d9cfe6b9c2c34aa22cfcaac37a5c45, 6.3
Not affected: before 6.3, from 6.6.140 up to 6.6.*, from 6.12.88 up to 6.12.*, from 6.18.30 up to 6.18.*, from 7.0.7 up to 7.0.*, from 7.1 up to *
CVE List
linux linux_kernelfrom 6.3 before 6.6.140, from 6.7 before 6.12.88, from 6.13 before 6.18.30, from 6.19 before 7.0.7NVD

Classification

What each source says

CVE List

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.

NVD (es)

En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: lib/scatterlist: corrige los cálculos de longitud en extract_kvec_to_sg Serie de parches 'Corrige errores en extract_iter_to_sg()', v3. Corrige errores en las variantes kvec y de usuario de extract_iter_to_sg. Esta serie está creciendo debido a comentarios útiles hechos por sashiko.dev. Los principales errores son: - La longitud para una entrada de sglist al extraer de un kvec puede exceder el número de bytes en la página. Esto obviamente no está previsto. - Al extraer un búfer de usuario, el sglist se utiliza temporalmente como un búfer temporal para punteros de página extraídos. Si el sglist ya contiene algunos elementos, este búfer temporal podría superponerse con entradas existentes en el sglist. La serie añade casos de prueba a la prueba kunit_iov_iter que demuestran todos estos errores. Además, hay una corrección de fuga de memoria para la propia prueba. Los errores fueron introducidos originalmente en el kernel v6.3 donde la función residía en fs/netfs/iterator.c. Posteriormente fue movida a lib/scatterlist.c en v6.5. Por lo tanto, la corrección real solo está marcada para backports a v6.5+. Este parche (de 5): Al extraer de un kvec a un scatterlist, no cruzar los límites de página. La longitud requerida ya estaba calculada pero no se usó como se pretendía. Ajustar la longitud copiada si el bucle se queda sin entradas de sglist sin extraer todo. Mientras tanto, regresar inmediatamente de extract_iter_to_sg si no hay ninguna entrada de sglist en absoluto. Un commit posterior añadirá casos de prueba kunit que demuestran que el parche es necesario.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-46289 changed 2026-08-05CVE Terms of Use
NVDCVE-2026-46289 changed 2026-07-23Public domain