CVE-2026-139543: scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets
In the Linux kernel, the following vulnerability has been resolved:
scsi: scsidebug: Avoid 32-bit overflow in WRITE SCATTERED offsets
respwritescat() computes the length of an LBA range in bytes as a 32-bit product, numby = num lbsize, and adds it to sgoff, the 32-bit offset of the next range in the data-out buffer. The product wraps for a range of 4 GiB or more, which checkdeviceaccessparams() allows once the store is that large, and sgoff wraps once the ranges add up to 4 GiB, which neither their number nor their overlap prevents. The ranges that follow are then written from the wrong offset in the buffer.
Make numby and sgoff 64-bit, and pass dodeviceaccess() sgoff capped at the length of the buffer. An offset at the end of the buffer copies nothing, and sgcopybuffer(), which takes it as an offt, is never given one larger than the buffer that it copies.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.120 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.65 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1 - Compensating control
In scsi_debug, make num_by and sg_off 64-bit to prevent 32-bit overflow in WRITE SCATTERED offsets.
Event History
Frequently Asked Questions
What conditions are required to trigger the incorrect buffer offset handling?
The WRITE SCATTERED operation must include an LBA range whose byte length is at least 4 GiB, or enough ranges for their cumulative data-out buffer offset to reach 4 GiB. The backing store must be large enough for check_device_access_params() to permit the range.
What is the impact once the offset wraps?
Subsequent ranges can be written using the wrong offset in the data-out buffer. This occurs because the original 32-bit range-length calculation or cumulative offset can wrap.