Skip to contentSkip to conversation

CVE-2022-50876: usb: musb: Fix musb_gadget.c rxstate overflow bug

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 30, 2025

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: musb: Fix musb_gadget.c rxstate overflow bug

The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds.

Fix it by add the length check :
fifocnt = min_t(unsigned, request->length - request->actual, fifocnt);

The Linux kernel CVE team has assigned CVE-2022-50876 to this issue.

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

	Fixed in 4.9.331 with commit 826f84ab04a5cafe484ea9c2c85a3930068e5cb7
	Fixed in 4.14.296 with commit a1008c8b9f357691ce6a8fdb8f157aecb2d79167
	Fixed in 4.19.262 with commit 7c80f3a918ba9aa26fb699ee887064ec3af0396a
	Fixed in 5.4.220 with commit d6afcab1b48f4051211c50145b9e91be3b1b42c9
	Fixed in 5.10.150 with commit acf0006f2b2b2ca672988875fd154429aafb2a9b
	Fixed in 5.15.75 with commit 3c84c7f592c4ba38f54ddaddd0115acc443025db
	Fixed in 5.19.17 with commit a9ccd2ab1becf5dcb6d57e9fcd981f5eaa606c96
	Fixed in 6.0.3 with commit 523313881f0aa5cbbdb548ce575b6e58b202bd76
	Fixed in 6.1 with commit eea4c860c3b366369eff0489d94ee4f0571d467d

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-2022-50876

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/musb/musb_gadget.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/826f84ab04a5cafe484ea9c2c85a3930068e5cb7
	https://git.kernel.org/stable/c/a1008c8b9f357691ce6a8fdb8f157aecb2d79167
	https://git.kernel.org/stable/c/7c80f3a918ba9aa26fb699ee887064ec3af0396a
	https://git.kernel.org/stable/c/d6afcab1b48f4051211c50145b9e91be3b1b42c9
	https://git.kernel.org/stable/c/acf0006f2b2b2ca672988875fd154429aafb2a9b
	https://git.kernel.org/stable/c/3c84c7f592c4ba38f54ddaddd0115acc443025db
	https://git.kernel.org/stable/c/a9ccd2ab1becf5dcb6d57e9fcd981f5eaa606c96
	https://git.kernel.org/stable/c/523313881f0aa5cbbdb548ce575b6e58b202bd76
	https://git.kernel.org/stable/c/eea4c860c3b366369eff0489d94ee4f0571d467d