CVE-2026-31412 json
usb: gadget: f_mass_storage: Fix potential integer overflow in check_command_size_in_blocks()
published 2026-04-10 7 mo ago modified 2026-06-17 4 mo ago also EUVD-2026-21361
- cvss
- 5.5
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 6%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- Linux Linux 6.1.167, 6.6.130, 6.12.78, 6.18.19, 6.19.9, 7.0
- linux Debian 12 6.1.170-1
- linux Debian 13 6.12.85-1
- linux Debian 14 6.19.10-1
debian advisories DEBIAN-CVE-2026-31412
- linux Ubuntu 24.04 LTS 6.8.0-136.136
- linux-aws Ubuntu 24.04 LTS 6.8.0-1061.64
- linux-gcp Ubuntu 24.04 LTS 6.8.0-1064.72
- linux-gke Ubuntu 24.04 LTS 6.8.0-1059.67
- linux-ibm Ubuntu 24.04 LTS 6.8.0-1061.62
- linux-azure Ubuntu 24.04 LTS 6.8.0-1063.71
- linux-gkeop Ubuntu 24.04 LTS 6.8.0-1046.50
- linux-raspi Ubuntu 24.04 LTS 6.8.0-1061.65
ubuntu advisories UBUNTU-CVE-2026-31412
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- kernel-64kb SLE Module for Basesystem 15 SP7 6.4.0-150700.53.55.1
- kernel-syms SLE Module for Development Tools 15 SP7 6.4.0-150700.53.55.1
- kernel-azure SLE Module for Public Cloud 15 SP7 6.4.0-150700.53.55.1
- kernel-source SLE Module for Development Tools 15 SP7, SLE Module for Basesystem 15 SP7 6.4.0-150700.53.55.1
- kernel-default SLE Workstation Extension 15 SP7, SLE Module for Legacy 15 SP7, SLE Module for Basesystem 15 SP7 +2 more 6.4.0-150700.53.55.1
- kernel-zfcpdump SLE Module for Basesystem 15 SP7 6.4.0-150700.53.55.1
- kernel-obs-build SLE Module for Development Tools 15 SP7 6.4.0-150700.53.55.1
- kernel-default-base SLE Module for Basesystem 15 SP7 6.4.0-150700.53.55.1.150700.17.33.1
suse advisories SUSE-SU-2026:2238-1SUSE-SU-2026:21834-1
- git.kernel.org/stable/c/91817ad5452defe69bc7bc0e355f0ed5d01125cc commit
- git.kernel.org/stable/c/ce0caaed5940162780c5c223b8ae54968a5f059b commit
- git.kernel.org/stable/c/228b37936376143f4b60cc6828663f6eaceb81b5 commit
- git.kernel.org/stable/c/3428dc5520c811e66622b2f5fa43341bf9a1f8b3 commit
- git.kernel.org/stable/c/387ebb0453b99d71491419a5dc4ab4bee0cacbac commit
- git.kernel.org/stable/c/8479891d1f04a8ce55366fe4ca361ccdb96f02e1 commit
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2026-31412 updated
kernel: usb: gadget: f_mass_storage: Fix potential integer overflow in check_command_size_in_blocks()
-
Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 more Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 more Red Hat Enterprise Linux 9 rv, perf, rtla, kernel, bpftool, libperf, +83 more Red Hat Enterprise Linux 10 kernelnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
0.17% chance of exploitation in the next 30 days, higher than 6% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| NVD | 3.1 | 5.5 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Affected products
- Linux Linux
Classification
- Weakness
-
- CWE-190 Integer Overflow or Wraparound
- Technology feeds
References
-
git.kernel.org
/stable/c/91817ad5452defe69bc7bc0e355f0ed5d01125cc
patch
-
git.kernel.org
/stable/c/ce0caaed5940162780c5c223b8ae54968a5f059b
patch
-
git.kernel.org
/stable/c/228b37936376143f4b60cc6828663f6eaceb81b5
patch
-
git.kernel.org
/stable/c/3428dc5520c811e66622b2f5fa43341bf9a1f8b3
patch
-
git.kernel.org
/stable/c/387ebb0453b99d71491419a5dc4ab4bee0cacbac
patch
-
git.kernel.org
/stable/c/8479891d1f04a8ce55366fe4ca361ccdb96f02e1
patch
Sources
- CVE List CVE-2026-31412
- NVD CVE-2026-31412
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.