Subject: CVE-2021-47571: staging: rtl8192e: Fix use after free in _rtl92e_pci_disconnect()

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

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

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

staging: rtl8192e: Fix use after free in _rtl92e_pci_disconnect()

The free_rtllib() function frees the "dev" pointer so there is use
after free on the next line.  Re-arrange things to avoid that.

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

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

	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 4.4.294 with commit d43aecb694b1
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 4.9.292 with commit 918668038293
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 4.14.257 with commit c0ef0e75a858
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 4.19.219 with commit bca19bb2dc2d
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 5.4.163 with commit 2e1ec01af2c7
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 5.10.83 with commit 8d0163cec7de
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 5.15.6 with commit e27ee2f607fe
	Issue introduced in 3.2 with commit 66898177e7e5 and fixed in 5.16 with commit b535917c51ac

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-47571
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/rtl8192e/rtl8192e/rtl_core.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/d43aecb694b10db9a4228ce2d38b5ae8de374443
	https://git.kernel.org/stable/c/9186680382934b0e7529d3d70dcc0a21d087683b
	https://git.kernel.org/stable/c/c0ef0e75a858cbd8618b473f22fbca36106dcf82
	https://git.kernel.org/stable/c/bca19bb2dc2d89ce60c4a4a6e59609d4cf2e13ef
	https://git.kernel.org/stable/c/2e1ec01af2c7139c6a600bbfaea1a018b35094b6
	https://git.kernel.org/stable/c/8d0163cec7de995f9eb9c3128c83fb84f0cb1c64
	https://git.kernel.org/stable/c/e27ee2f607fe6a9b923ef1fc65461c0613c97594
	https://git.kernel.org/stable/c/b535917c51acc97fb0761b1edec85f1f3d02bda4