CVE-2026-31412 Details
Description
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_mass_storage: Fix potential integer overflow in check_command_size_in_blocks() The `check_command_size_in_blocks()` function calculates the data size in bytes by left shifting `common->data_size_from_cmnd` by the block size (`common->curlun->blkbits`). However, it does not validate whether this shift operation will cause an integer overflow. Initially, the block size is set up in `fsg_lun_open()` , and the `common->data_size_from_cmnd` is set up in `do_scsi_command()`. During initialization, there is no integer overflow check for the interaction between two variables. So if a malicious USB host sends a SCSI READ or WRITE command requesting a large amount of data (`common->data_size_from_cmnd`), the left shift operation can wrap around. This results in a truncated data size, which can bypass boundary checks and potentially lead to memory corruption or out-of-bounds accesses. Fix this by using the check_shl_overflow() macro to safely perform the shift and catch any overflows.
A potential integer overflow vulnerability has been identified in the Linux kernel's USB gadget function for mass storage. The issue arises in the 'check_command_size_in_blocks()' function, which calculates data size by left-shifting 'common->data_size_from_cmnd' by the block size. This operation lacks proper validation, allowing a malicious USB host to send SCSI commands that request excessive data. The resulting overflow can truncate the data size, bypass boundary checks, and lead to memory corruption or out-of-bounds access.
Users can update to the latest version of the Linux kernel where this vulnerability has been patched. The patch is included in the official Linux kernel repositories.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
No SSVC data is available for this CVE.
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://git.kernel.org/stable/c/228b37936376143f4b60cc6828663f6eaceb81b5 | kernel.org | Patch |
| https://git.kernel.org/stable/c/3428dc5520c811e66622b2f5fa43341bf9a1f8b3 | kernel.org | Patch |
| https://git.kernel.org/stable/c/387ebb0453b99d71491419a5dc4ab4bee0cacbac | kernel.org | Patch |
| https://git.kernel.org/stable/c/8479891d1f04a8ce55366fe4ca361ccdb96f02e1 | kernel.org | Patch |
| https://git.kernel.org/stable/c/91817ad5452defe69bc7bc0e355f0ed5d01125cc | kernel.org | Patch |
| https://git.kernel.org/stable/c/ce0caaed5940162780c5c223b8ae54968a5f059b | kernel.org | Patch |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-190 | Integer Overflow or Wraparound | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| linux linux kernel | >= 3.3, < 6.1.167 >= 6.2, < 6.6.130 >= 6.7, < 6.12.78 >= 6.13, < 6.18.19 >= 6.19, < 6.19.9 7.0 rc1 7.0 rc2 7.0 rc3 7.0 rc4 |
CPE
Remediation
| |
Change History
3 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | kernel.org |
| May 20, 2026 | Initial Analysis | [email protected] |
| Apr 10, 2026 | New CVE Received | kernel.org |