linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Kalle Valo <kvalo@kernel.org>,
	Jeff Johnson <quic_jjohnson@quicinc.com>,
	Balamurugan Selvarajan <quic_bselvara@quicinc.com>,
	P Praneesh <quic_ppranees@quicinc.com>,
	Baochen Qiang <quic_bqiang@quicinc.com>,
	Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Ramya Gnanasekar <quic_rgnanase@quicinc.com>,
	Wen Gong <quic_wgong@quicinc.com>,
	Karthik M <quic_karm@quicinc.com>,
	Aditya Kumar Singh <quic_adisi@quicinc.com>,
	Aishwarya R <quic_aisr@quicinc.com>,
	Carl Huang <quic_cjhuang@quicinc.com>,
	ath12k@lists.infradead.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he
Date: Mon,  3 Jul 2023 14:37:29 +0200	[thread overview]
Message-ID: <20230703123737.3420464-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2023-07-03 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 12:37 Arnd Bergmann [this message]
2023-08-02 16:56 ` [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230703123737.3420464-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=ath12k@lists.infradead.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_adisi@quicinc.com \
    --cc=quic_aisr@quicinc.com \
    --cc=quic_bqiang@quicinc.com \
    --cc=quic_bselvara@quicinc.com \
    --cc=quic_cjhuang@quicinc.com \
    --cc=quic_jjohnson@quicinc.com \
    --cc=quic_karm@quicinc.com \
    --cc=quic_periyasa@quicinc.com \
    --cc=quic_ppranees@quicinc.com \
    --cc=quic_rgnanase@quicinc.com \
    --cc=quic_wgong@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).