Subject: CVE-2021-47331: usb: common: usb-conn-gpio: fix NULL pointer dereference of charger

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

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

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

usb: common: usb-conn-gpio: fix NULL pointer dereference of charger

When power on system with OTG cable, IDDIG's interrupt arises before
the charger registration, it will cause a NULL pointer dereference,
fix the issue by registering the power supply before requesting
IDDIG/VBUS irq.

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

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

	Fixed in 5.10.52 with commit 8e8d910e9a3a
	Fixed in 5.12.19 with commit 436906fd248e
	Fixed in 5.13.4 with commit 1a133a0996d6
	Fixed in 5.14 with commit 880287910b18

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-47331
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/common/usb-conn-gpio.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/8e8d910e9a3a7fba86140aff4924c30955ab228b
	https://git.kernel.org/stable/c/436906fd248e018403bcda61a9311d9af02912f1
	https://git.kernel.org/stable/c/1a133a0996d6b4c83509d570ed4edcba34c44f25
	https://git.kernel.org/stable/c/880287910b1892ed2cb38977893b947382a09d21