Subject: CVE-2021-47347: wl1251: Fix possible buffer overflow in wl1251_cmd_scan

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

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

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

wl1251: Fix possible buffer overflow in wl1251_cmd_scan

Function wl1251_cmd_scan calls memcpy without checking the length.
Harden by checking the length is within the maximum allowed size.

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

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

	Fixed in 4.4.276 with commit 57ad99ae3c67
	Fixed in 4.9.276 with commit d3d8b9c9c784
	Fixed in 4.14.240 with commit 0f6c0488368c
	Fixed in 4.19.198 with commit 115103f6e3f1
	Fixed in 5.4.133 with commit d71dddeb5380
	Fixed in 5.10.51 with commit c5e4a10d7bd5
	Fixed in 5.12.18 with commit 302e2ee34c5f
	Fixed in 5.13.3 with commit 40af3960a153
	Fixed in 5.14 with commit d10a87a3535c

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-47347
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/wireless/ti/wl1251/cmd.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/57ad99ae3c6738ba87bad259bb57c641ca68ebf6
	https://git.kernel.org/stable/c/d3d8b9c9c7843dce31e284927d4c9904fd5a510a
	https://git.kernel.org/stable/c/0f6c0488368c9ac1aa685821916fadba32f5d1ef
	https://git.kernel.org/stable/c/115103f6e3f1c26c473766c16439c7c8b235529a
	https://git.kernel.org/stable/c/d71dddeb5380613f9ef199f3e7368fd78fb1a46e
	https://git.kernel.org/stable/c/c5e4a10d7bd5d4f419d8b9705dff60cf69b302a1
	https://git.kernel.org/stable/c/302e2ee34c5f7c5d805b7f835d9a6f2b43474e2a
	https://git.kernel.org/stable/c/40af3960a15339e8bbd3be50c3bc7b35e1a0b6ea
	https://git.kernel.org/stable/c/d10a87a3535cce2b890897914f5d0d83df669c63