Subject: CVE-2024-50008: wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_cmd_802_11_scan_ext()

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

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

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

wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_cmd_802_11_scan_ext()

Replace one-element array with a flexible-array member in
`struct host_cmd_ds_802_11_scan_ext`.

With this, fix the following warning:

elo 16 17:51:58 surfacebook kernel: ------------[ cut here ]------------
elo 16 17:51:58 surfacebook kernel: memcpy: detected field-spanning write (size 243) of single field "ext_scan->tlv_buffer" at drivers/net/wireless/marvell/mwifiex/scan.c:2239 (size 1)
elo 16 17:51:58 surfacebook kernel: WARNING: CPU: 0 PID: 498 at drivers/net/wireless/marvell/mwifiex/scan.c:2239 mwifiex_cmd_802_11_scan_ext+0x83/0x90 [mwifiex]

The Linux kernel CVE team has assigned CVE-2024-50008 to this issue.

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

	Fixed in 5.10.227 with commit 1756918f51e9
	Fixed in 5.15.168 with commit e59bdb1ba594
	Fixed in 6.1.113 with commit 17199b69a847
	Fixed in 6.6.55 with commit fef7b51f22cf
	Fixed in 6.10.14 with commit 71267bd4e8c7
	Fixed in 6.11.3 with commit a3a12c30f951
	Fixed in 6.12-rc1 with commit 498365e52beb

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-2024-50008
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/marvell/mwifiex/fw.h
	drivers/net/wireless/marvell/mwifiex/scan.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/1756918f51e9ab247a0f4782cc28853c2bb457c1
	https://git.kernel.org/stable/c/e59bdb1ba594104cd0ee0af3ee9e4435d842a8fe
	https://git.kernel.org/stable/c/17199b69a84798efffc475040fbef44374ef1de1
	https://git.kernel.org/stable/c/fef7b51f22cf2049b0ca6740adeb0ba6f2e671dc
	https://git.kernel.org/stable/c/71267bd4e8c752d7af6c6b96bb83984a6a95273d
	https://git.kernel.org/stable/c/a3a12c30f9510f3753286fadbc6cdb7dad78c1d5
	https://git.kernel.org/stable/c/498365e52bebcbc36a93279fe7e9d6aec8479cee