Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B920C208DA for ; Thu, 29 Feb 2024 22:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709246292; cv=none; b=IlOo06EiRjXslUZ1gzF+P9+/ebAEgPgF+GqrHdvYKBUv7Nczv7QbAuJOrgutoHIX8HG2pSNWSLPVR8lxvKCmdvOsxXnEYP3pvDbBoHIhzcQaXUGFVrq8LQoF6zYmGsK4tKHcpPJobFLRUgNdN9BJ3BLs4hNUBaYeC7cOIB8uLT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709246292; c=relaxed/simple; bh=qcAPeLy8eSLHRmcJIlGL3EhWwPCsZ8HTWYM9RxmF1uE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DMIB/flnUkoxESVmxDC9KqO4PFCSfCM1Yww7sn9xHFCIhaceVKfu5ujimfTC4WrDr0+3Tqm47ieoNEgdAGgANoX7ztGlOUUEcvSyN+pFvlbktVt7UPx9V5OEkdmGJONkb41BPtPm1vJy7wG6TO7Vdp0f9nnOCrjlsXdTVbxd5Ew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mN7f0r96; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mN7f0r96" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2C75C433F1; Thu, 29 Feb 2024 22:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709246292; bh=qcAPeLy8eSLHRmcJIlGL3EhWwPCsZ8HTWYM9RxmF1uE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=mN7f0r96ksR5ZwumE5Jwf/gNh5XpJJJtyPmQSQrr5On05rYcooTl3FQIi2qviAe8m 8DnEipCE0FKRgNeR0Ke/33aDimsvs+5OfBtwCKbpjhgA0ufKLDX46QrAesEGMt05jr wRqMDhFx+zQ4HBzZ/Tcki/whxszqN6LAYqRttV68= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47065: rtw88: Fix array overrun in rtw_get_tx_power_params() Date: Thu, 29 Feb 2024 23:38:02 +0100 Message-ID: <2024022954-CVE-2021-47065-be1d@gregkh> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4554; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=qcAPeLy8eSLHRmcJIlGL3EhWwPCsZ8HTWYM9RxmF1uE=; b=owGbwMvMwCRo6H6F97bub03G02pJDKkP2Z2UtbcdSZRw4JD/sUyL8aE8Q5BH8NxDCVxsQYUhL /N2HtDoiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIlsX84wV0Jo8eMrTHK32afP nlGwc5vY77NPehjm2V3cuvYV+4/u+mzzP/1qkt0fhew3AAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: rtw88: Fix array overrun in rtw_get_tx_power_params() Using a kernel with the Undefined Behaviour Sanity Checker (UBSAN) enabled, the following array overrun is logged: ================================================================================ UBSAN: array-index-out-of-bounds in /home/finger/wireless-drivers-next/drivers/net/wireless/realtek/rtw88/phy.c:1789:34 index 5 is out of range for type 'u8 [5]' CPU: 2 PID: 84 Comm: kworker/u16:3 Tainted: G O 5.12.0-rc5-00086-gd88bba47038e-dirty #651 Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50 09/29/2014 Workqueue: phy0 ieee80211_scan_work [mac80211] Call Trace: dump_stack+0x64/0x7c ubsan_epilogue+0x5/0x40 __ubsan_handle_out_of_bounds.cold+0x43/0x48 rtw_get_tx_power_params+0x83a/drivers/net/wireless/realtek/rtw88/0xad0 [rtw_core] ? rtw_pci_read16+0x20/0x20 [rtw_pci] ? check_hw_ready+0x50/0x90 [rtw_core] rtw_phy_get_tx_power_index+0x4d/0xd0 [rtw_core] rtw_phy_set_tx_power_level+0xee/0x1b0 [rtw_core] rtw_set_channel+0xab/0x110 [rtw_core] rtw_ops_config+0x87/0xc0 [rtw_core] ieee80211_hw_config+0x9d/0x130 [mac80211] ieee80211_scan_state_set_channel+0x81/0x170 [mac80211] ieee80211_scan_work+0x19f/0x2a0 [mac80211] process_one_work+0x1dd/0x3a0 worker_thread+0x49/0x330 ? rescuer_thread+0x3a0/0x3a0 kthread+0x134/0x150 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x22/0x30 ================================================================================ The statement where an array is being overrun is shown in the following snippet: if (rate <= DESC_RATE11M) tx_power = pwr_idx_2g->cck_base[group]; else ====> tx_power = pwr_idx_2g->bw40_base[group]; The associated arrays are defined in main.h as follows: struct rtw_2g_txpwr_idx { u8 cck_base[6]; u8 bw40_base[5]; struct rtw_2g_1s_pwr_idx_diff ht_1s_diff; struct rtw_2g_ns_pwr_idx_diff ht_2s_diff; struct rtw_2g_ns_pwr_idx_diff ht_3s_diff; struct rtw_2g_ns_pwr_idx_diff ht_4s_diff; }; The problem arises because the value of group is 5 for channel 14. The trivial increase in the dimension of bw40_base fails as this struct must match the layout of efuse. The fix is to add the rate as an argument to rtw_get_channel_group() and set the group for channel 14 to 4 if rate <= DESC_RATE11M. This patch fixes commit fa6dfe6bff24 ("rtw88: resolve order of tx power setting routines") The Linux kernel CVE team has assigned CVE-2021-47065 to this issue. Affected and fixed versions =========================== Issue introduced in 5.3 with commit fa6dfe6bff24 and fixed in 5.4.119 with commit 6b5aa0cf321c Issue introduced in 5.3 with commit fa6dfe6bff24 and fixed in 5.10.37 with commit 95fb153c6027 Issue introduced in 5.3 with commit fa6dfe6bff24 and fixed in 5.11.21 with commit 5f3dbced8eaa Issue introduced in 5.3 with commit fa6dfe6bff24 and fixed in 5.12.4 with commit 9cd09722e18a Issue introduced in 5.3 with commit fa6dfe6bff24 and fixed in 5.13 with commit 2ff25985ea9c Please see https://www.kernel.org or 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-47065 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/realtek/rtw88/phy.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/6b5aa0cf321c25f41e09a61c83ee4dc7ab9549cb https://git.kernel.org/stable/c/95fb153c6027924cda3422120169d1890737f3a0 https://git.kernel.org/stable/c/5f3dbced8eaa5c9ed7d6943f3fea99f235a6516a https://git.kernel.org/stable/c/9cd09722e18a08b6a3d68b8bccfac39ddc22434c https://git.kernel.org/stable/c/2ff25985ea9ccc6c9af2c77b0b49045adcc62e0e