linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he
@ 2023-07-03 12:37 Arnd Bergmann
  2023-08-02 16:56 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2023-07-03 12:37 UTC (permalink / raw)
  To: Kalle Valo, Jeff Johnson, Balamurugan Selvarajan, P Praneesh,
	Baochen Qiang, Karthikeyan Periyasamy
  Cc: Arnd Bergmann, Ramya Gnanasekar, Wen Gong, Karthik M,
	Aditya Kumar Singh, Aishwarya R, Carl Huang, ath12k,
	linux-wireless, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Two memory copies in this function copy from a short array into a longer one,
using the wrong size, which leads to an out-of-bounds access:

include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);
                        ^
include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
2 errors generated.

Fixes: d889913205cf7 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/ath/ath12k/mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index f5ebebe806e0d..b8a8d33cc4187 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1637,9 +1637,9 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
 	arg->peer_nss = min(sta->deflink.rx_nss, max_nss);
 
 	memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info,
-	       sizeof(arg->peer_he_cap_macinfo));
+	       sizeof(he_cap->he_cap_elem.mac_cap_info));
 	memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info,
-	       sizeof(arg->peer_he_cap_phyinfo));
+	       sizeof(he_cap->he_cap_elem.phy_cap_info));
 	arg->peer_he_ops = vif->bss_conf.he_oper.params;
 
 	/* the top most byte is used to indicate BSS color info */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he
  2023-07-03 12:37 [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he Arnd Bergmann
@ 2023-08-02 16:56 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2023-08-02 16:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jeff Johnson, Balamurugan Selvarajan, P Praneesh, Baochen Qiang,
	Karthikeyan Periyasamy, Arnd Bergmann, Ramya Gnanasekar, Wen Gong,
	Karthik M, Aditya Kumar Singh, Aishwarya R, Carl Huang, ath12k,
	linux-wireless, linux-kernel

Arnd Bergmann <arnd@kernel.org> wrote:

> Two memory copies in this function copy from a short array into a longer one,
> using the wrong size, which leads to an out-of-bounds access:
> 
> include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
>                         __read_overflow2_field(q_size_field, size);
>                         ^
> include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
> 2 errors generated.
> 
> Fixes: d889913205cf7 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

603cf6c2fcdc wifi: ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230703123737.3420464-1-arnd@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-02 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 12:37 [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he Arnd Bergmann
2023-08-02 16:56 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).