CVE-2023-54300: wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx
For the reasons also described in commit b383e8abed41 ("wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()"), ath9k_htc_rx_msg() should validate pkt_len before accessing the SKB.
For example, the obtained SKB may have been badly constructed with pkt_len = 8. In this case, the SKB can only contain a valid htc_frame_hdr but after being processed in ath9k_htc_rx_msg() and passed to ath9k_wmi_ctrl_rx() endpoint RX handler, it is expected to have a WMI command header which should be located inside its data payload.
Implement sanity checking inside ath9k_wmi_ctrl_rx(). Otherwise, uninit memory can be referenced.
Tested on Qualcomm Atheros Communications AR9271 802.11n .
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
The Linux kernel CVE team has assigned CVE-2023-54300 to this issue.
Affected and fixed versions
===========================
Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 4.14.322 with commit 0bc12e41af4e3ae1f0efecc377f0514459df0707 Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 4.19.291 with commit 28259ce4f1f1f9ab37fa817756c89098213d2fc0 Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 5.4.251 with commit 90e3c10177573b8662ac9858abd9bf731d5d98e0 Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 5.10.188 with commit 250efb4d3f5b32a115ea6bf25437ba44a1b3c04f Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 5.15.121 with commit ad5425e70789c29b93acafb5bb4629e4eb908296 Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 6.1.39 with commit d1c2ff2bd84c3692c9df267a2b991ce92bfca8ef Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 6.3.13 with commit 8ed572e52714593b209e3aa352406aff84481179 Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 6.4.4 with commit 75acec91aeaa07375cd5f418069e61b16d39bbad Issue introduced in 2.6.35 with commit fb9987d0f748c983bb795a86f47522313f701a08 and fixed in 6.5 with commit f24292e827088bba8de7158501ac25a59b064953
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-2023-54300
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/ath/ath9k/wmi.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/0bc12e41af4e3ae1f0efecc377f0514459df0707 https://git.kernel.org/stable/c/28259ce4f1f1f9ab37fa817756c89098213d2fc0 https://git.kernel.org/stable/c/90e3c10177573b8662ac9858abd9bf731d5d98e0 https://git.kernel.org/stable/c/250efb4d3f5b32a115ea6bf25437ba44a1b3c04f https://git.kernel.org/stable/c/ad5425e70789c29b93acafb5bb4629e4eb908296 https://git.kernel.org/stable/c/d1c2ff2bd84c3692c9df267a2b991ce92bfca8ef https://git.kernel.org/stable/c/8ed572e52714593b209e3aa352406aff84481179 https://git.kernel.org/stable/c/75acec91aeaa07375cd5f418069e61b16d39bbad https://git.kernel.org/stable/c/f24292e827088bba8de7158501ac25a59b064953