Subject: CVE-2021-47360: binder: make sure fd closes complete

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

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

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

binder: make sure fd closes complete

During BC_FREE_BUFFER processing, the BINDER_TYPE_FDA object
cleanup may close 1 or more fds. The close operations are
completed using the task work mechanism -- which means the thread
needs to return to userspace or the file object may never be
dereferenced -- which can lead to hung processes.

Force the binder thread back to userspace if an fd is closed during
BC_FREE_BUFFER handling.

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

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

	Issue introduced in 5.0 with commit 80cd795630d6 and fixed in 5.4.150 with commit aa2c274c279f
	Issue introduced in 5.0 with commit 80cd795630d6 and fixed in 5.10.70 with commit d5b0473707fa
	Issue introduced in 5.0 with commit 80cd795630d6 and fixed in 5.14.9 with commit b95483d8d94b
	Issue introduced in 5.0 with commit 80cd795630d6 and fixed in 5.15 with commit 5fdb55c1ac95
	Issue introduced in 4.20.1 with commit 27564d8d5d12

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-47360
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/android/binder.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/aa2c274c279ff365a06a4cba263f04965895166e
	https://git.kernel.org/stable/c/d5b0473707fa53b03a5db0256ce62b2874bddbc7
	https://git.kernel.org/stable/c/b95483d8d94b41fa31a84c1d86710b7907a37621
	https://git.kernel.org/stable/c/5fdb55c1ac9585eb23bb2541d5819224429e103d