Subject: CVE-2021-47310: net: ti: fix UAF in tlan_remove_one

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

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

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

net: ti: fix UAF in tlan_remove_one

priv is netdev private data and it cannot be
used after free_netdev() call. Using priv after free_netdev()
can cause UAF bug. Fix it by moving free_netdev() at the end of the
function.

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

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

	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 4.4.277 with commit a18a8d9cfbb1
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 4.9.277 with commit c263ae8c7e4c
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 4.14.241 with commit 0538b0ab7d2c
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 4.19.199 with commit a0a817b2d308
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 5.4.135 with commit b7e5563f2a78
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 5.10.53 with commit f2a062fcfe1d
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 5.13.5 with commit 93efab0ef2a6
	Issue introduced in 3.10 with commit 1e0a8b13d355 and fixed in 5.14 with commit 0336f8ffece6

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-47310
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/net/ethernet/ti/tlan.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/a18a8d9cfbb112ad72e625372849adc3986fd6bf
	https://git.kernel.org/stable/c/c263ae8c7e4c482387de5e6c89e213f8173fe8b6
	https://git.kernel.org/stable/c/0538b0ab7d2c396e385694228c7cdcd2d2c514e9
	https://git.kernel.org/stable/c/a0a817b2d308fac090a05cbbe80988e073ac5193
	https://git.kernel.org/stable/c/b7e5563f2a7862a9e4796abb9908b092f677e3c1
	https://git.kernel.org/stable/c/f2a062fcfe1d6f1b0a86fa76ae21c277d65f4405
	https://git.kernel.org/stable/c/93efab0ef2a607fff9166d447c4035f98b5db342
	https://git.kernel.org/stable/c/0336f8ffece62f882ab3012820965a786a983f70