Subject: CVE-2021-47278: bus: mhi: pci_generic: Fix possible use-after-free in mhi_pci_remove()

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

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

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

bus: mhi: pci_generic: Fix possible use-after-free in mhi_pci_remove()

This driver's remove path calls del_timer(). However, that function
does not wait until the timer handler finishes. This means that the
timer handler may still be running after the driver's remove function
has finished, which would result in a use-after-free.

Fix by calling del_timer_sync(), which makes sure the timer handler
has finished, and unable to re-schedule itself.

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

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

	Issue introduced in 5.12 with commit 8562d4fe34a3 and fixed in 5.12.11 with commit c597d5c59c7a
	Issue introduced in 5.12 with commit 8562d4fe34a3 and fixed in 5.13 with commit 0b67808ade88

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-47278
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/bus/mhi/pci_generic.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/c597d5c59c7a6417dba06590f59b922e01188e8d
	https://git.kernel.org/stable/c/0b67808ade8893a1b3608ddd74fac7854786c919