Skip to contentSkip to conversation

CVE-2026-31720: usb: gadget: f_uac1_legacy: validate control request size

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 1

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: f_uac1_legacy: validate control request size

f_audio_complete() copies req->length bytes into a 4-byte stack variable:

  u32 data = 0;
  memcpy(&data, req->buf, req->length);

req->length is derived from the host-controlled USB request path, which can lead to a stack out-of-bounds write.

Validate req->actual against the expected payload size for the supported control selectors and decode only the expected amount of data.

This avoids copying a host-influenced length into a fixed-size stack object.

The Linux kernel CVE team has assigned CVE-2026-31720 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.10.253 with commit 557d1d4e862eccd0b74cc377b66de3e1e8d49605
	Fixed in 5.15.203 with commit 21b11e8581285c6f10ef43d05df349d445f24273
	Fixed in 6.1.168 with commit 0d41772d98dcaf6c17e875b7d0ea0154ae1191ee
	Fixed in 6.6.134 with commit c6da4fed7537aec19880c24f6c3a95065adb1406
	Fixed in 6.12.81 with commit be2d32f0c3fe333d14c0a9ca90328dacbc3e06b8
	Fixed in 6.18.22 with commit 8e5eb1d6e6a3d7bbea9c92132d0cda5793176426
	Fixed in 6.19.12 with commit 26304d124e7f0383f8fe1168b5801a0ac7e16b1c
	Fixed in 7.0 with commit 6e0e34d85cd46ceb37d16054e97a373a32770f6c

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-31720

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/usb/gadget/function/f_uac1_legacy.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/557d1d4e862eccd0b74cc377b66de3e1e8d49605
	https://git.kernel.org/stable/c/21b11e8581285c6f10ef43d05df349d445f24273
	https://git.kernel.org/stable/c/0d41772d98dcaf6c17e875b7d0ea0154ae1191ee
	https://git.kernel.org/stable/c/c6da4fed7537aec19880c24f6c3a95065adb1406
	https://git.kernel.org/stable/c/be2d32f0c3fe333d14c0a9ca90328dacbc3e06b8
	https://git.kernel.org/stable/c/8e5eb1d6e6a3d7bbea9c92132d0cda5793176426
	https://git.kernel.org/stable/c/26304d124e7f0383f8fe1168b5801a0ac7e16b1c
	https://git.kernel.org/stable/c/6e0e34d85cd46ceb37d16054e97a373a32770f6c