Subject: CVE-2021-47270: usb: fix various gadgets null ptr deref on 10gbps cabling.

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

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

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

usb: fix various gadgets null ptr deref on 10gbps cabling.

This avoids a null pointer dereference in
f_{ecm,eem,hid,loopback,printer,rndis,serial,sourcesink,subset,tcm}
by simply reusing the 5gbps config for 10gbps.

The Linux kernel CVE team has assigned CVE-2021-47270 to this issue.

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

	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 4.9.273 with commit beb1e67a5ca8
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 4.14.237 with commit 8cd5f45c1b76
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 4.19.195 with commit 10770d2ac009
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 5.4.126 with commit b4903f7fdc48
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 5.10.44 with commit 4b289a0f3033
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 5.12.11 with commit f17aae7c4009
	Issue introduced in 4.6 with commit eaef50c76057 and fixed in 5.13 with commit 90c4d05780d4

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-2021-47270
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_ecm.c
	drivers/usb/gadget/function/f_eem.c
	drivers/usb/gadget/function/f_hid.c
	drivers/usb/gadget/function/f_loopback.c
	drivers/usb/gadget/function/f_printer.c
	drivers/usb/gadget/function/f_rndis.c
	drivers/usb/gadget/function/f_serial.c
	drivers/usb/gadget/function/f_sourcesink.c
	drivers/usb/gadget/function/f_subset.c
	drivers/usb/gadget/function/f_tcm.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/beb1e67a5ca8d69703c776db9000527f44c0c93c
	https://git.kernel.org/stable/c/8cd5f45c1b769e3e9e0f4325dd08b6c3749dc7ee
	https://git.kernel.org/stable/c/10770d2ac0094b053c8897d96d7b2737cd72f7c5
	https://git.kernel.org/stable/c/b4903f7fdc484628d0b8022daf86e2439d3ab4db
	https://git.kernel.org/stable/c/4b289a0f3033f465b4fd51ba995251a7867a2aa2
	https://git.kernel.org/stable/c/f17aae7c4009160f0630a91842a281773976a5bc
	https://git.kernel.org/stable/c/90c4d05780d47e14a50e11a7f17373104cd47d25