Subject: CVE-2021-47358: staging: greybus: uart: fix tty use after free

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

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

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

staging: greybus: uart: fix tty use after free

User space can hold a tty open indefinitely and tty drivers must not
release the underlying structures until the last user is gone.

Switch to using the tty-port reference counter to manage the life time
of the greybus tty state to avoid use after free after a disconnect.

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

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

	Issue introduced in 4.9 with commit a18e15175708 and fixed in 4.9.285 with commit 92b67aaafb7c
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 4.14.249 with commit 64062fcaca88
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 4.19.209 with commit a5cfd51f6348
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 5.4.150 with commit 4dc56951a8d9
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 5.10.70 with commit b9e697e60ce9
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 5.14.9 with commit 9872ff6fdce8
	Issue introduced in 4.9 with commit a18e15175708 and fixed in 5.15 with commit 92dc0b1f46e1

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-47358
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/staging/greybus/uart.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/92b67aaafb7c449db9f0c3dcabc0ff967cb3a42d
	https://git.kernel.org/stable/c/64062fcaca8872f063ec9da011e7bf30470be33f
	https://git.kernel.org/stable/c/a5cfd51f6348e8fd7531461366946039c29c7e69
	https://git.kernel.org/stable/c/4dc56951a8d9d61d364d346c61a5f1d70b4f5e14
	https://git.kernel.org/stable/c/b9e697e60ce9890e9258a73eb061288e7d68e5e6
	https://git.kernel.org/stable/c/9872ff6fdce8b229f01993b611b5d1719cb70ff1
	https://git.kernel.org/stable/c/92dc0b1f46e12cfabd28d709bb34f7a39431b44f