From: Rivaldi Hormat <rivaldihormat@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: kvalo@kernel.org, ath10k@lists.infradead.org,
Rivaldi Hormat <rivaldihormat@gmail.com>
Subject: [PATCH 1/2] wifi: ath10k: Add missing validation in debugfs mem_value and reg_value
Date: Fri, 11 Sep 2026 07:23:16 +0000 [thread overview]
Message-ID: <20260911072318.5232-1-rivaldihormat@gmail.com> (raw)
mem_value and reg_value don't validate the address and size provided
by the user. This can lead to out-of-bounds access to hardware memory
and registers.
Fix this by adding the missing validation.
Signed-off-by: Rivaldi Hormat <rivaldihormat@gmail.com>
---
drivers/net/wireless/ath/ath10k/debug.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index fb61e53ff..50e017021 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -729,6 +729,13 @@ static ssize_t ath10k_reg_value_write(struct file *file,
reg_addr = ar->debug.reg_addr;
+ /* FIX: Validate register address */
+ if (reg_addr > ar->hw_params.reg_size) {
+ ath10k_warn(ar, "Invalid register address 0x%08x\n", reg_addr);
+ ret = -EINVAL;
+ goto exit;
+ }
+
ret = kstrtou32_from_user(user_buf, count, 0, ®_val);
if (ret)
goto exit;
@@ -819,6 +826,19 @@ static ssize_t ath10k_mem_value_write(struct file *file,
mutex_lock(&ar->conf_mutex);
+ /* FIX: Validate address against memory size */
+ if (*ppos > ar->hw_params.mem_size) {
+ ath10k_warn(ar, "Invalid address 0x%08x for mem_value\n", (u32)*ppos);
+ return -EINVAL;
+ }
+
+ /* FIX: Validate size against remaining memory */
+ if (count > ar->hw_params.mem_size - *ppos) {
+ ath10k_warn(ar, "Invalid size %zu for mem_value at 0x%08x\n",
+ count, (u32)*ppos);
+ return -EINVAL;
+ }
+
buf = vmalloc(count);
if (!buf) {
ret = -ENOMEM;
--
2.53.0
next reply other threads:[~2026-09-11 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 7:23 Rivaldi Hormat [this message]
2026-09-11 7:23 ` [PATCH 2/2] wifi: ath10k: Add missing validation in ath10k_htt_rx_proc_rx_frag_ind_hl Rivaldi Hormat
-- strict thread matches above, loose matches on Subject: below --
2026-09-10 8:06 [PATCH 1/2] wifi: ath10k: Add missing validation in debugfs mem_value and reg_value Rivaldi Hormat
2026-09-10 15:07 ` Jeff Johnson
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=20260911072318.5232-1-rivaldihormat@gmail.com \
--to=rivaldihormat@gmail.com \
--cc=ath10k@lists.infradead.org \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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