From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: maddy@linux.ibm.com
Cc: mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
pengpeng@iscas.ac.cn
Subject: [PATCH] powerpc/rtas-proc: reject oversized sensor properties
Date: Thu, 2 Apr 2026 00:03:17 +0800 [thread overview]
Message-ID: <20260401160317.88585-1-pengpeng@iscas.ac.cn> (raw)
ppc_rtas_find_all_sensors() derives the number of RTAS sensors from the
firmware property length and then copies that many entries into the
fixed sensors.sensor[MAX_SENSORS] array. A longer-than-expected property
can therefore overrun the static sensor table.
Reject rtas-sensors properties that would exceed the fixed sensor table.
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
arch/powerpc/kernel/rtas-proc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index f38df72e64b8..97a7d76ecf77 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -437,6 +437,10 @@ static int ppc_rtas_find_all_sensors(void)
}
sensors.quant = len / 8; /* int + int */
+ if (sensors.quant > ARRAY_SIZE(sensors.sensor)) {
+ pr_err("too many sensors reported: %u\n", sensors.quant);
+ return 1;
+ }
for (i=0; i<sensors.quant; i++) {
sensors.sensor[i].token = *utmp++;
--
2.50.1 (Apple Git-155)
reply other threads:[~2026-04-01 16:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260401160317.88585-1-pengpeng@iscas.ac.cn \
--to=pengpeng@iscas.ac.cn \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.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