Subject: CVE-2024-47714: wifi: mt76: mt7996: use hweight16 to get correct tx antenna

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

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

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

wifi: mt76: mt7996: use hweight16 to get correct tx antenna

The chainmask is u16 so using hweight8 cannot get correct tx_ant.
Without this patch, the tx_ant of band 2 would be -1 and lead to the
following issue:
BUG: KASAN: stack-out-of-bounds in mt7996_mcu_add_sta+0x12e0/0x16e0 [mt7996e]

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

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

	Issue introduced in 6.2 with commit 98686cd21624 and fixed in 6.6.54 with commit 50d87e3b7098
	Issue introduced in 6.2 with commit 98686cd21624 and fixed in 6.10.13 with commit 8f51fc8a9e2f
	Issue introduced in 6.2 with commit 98686cd21624 and fixed in 6.11.2 with commit 33954930870c
	Issue introduced in 6.2 with commit 98686cd21624 and fixed in 6.12-rc1 with commit f98c3de92bb0

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-47714
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/mediatek/mt76/mt7996/mcu.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/50d87e3b70980abc090676b6b4703fcbd96221f9
	https://git.kernel.org/stable/c/8f51fc8a9e2fd96363d8ec3f4ee4b78dd64754e3
	https://git.kernel.org/stable/c/33954930870c18ec549e4bca0eeff43e252cb740
	https://git.kernel.org/stable/c/f98c3de92bb05dac4a4969df8a4595ed380b4604