mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "jiale yao" <19888972804@163.com>
To: "Sunil V L" <sunilvl@ventanamicro.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Len Brown" <lenb@kernel.org>, "Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	linux-acpi@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re:[PATCH 2/2] ACPI: riscv: validate interrupt controller MADT entries
Date: Sat, 17 Oct 2026 15:27:17 +0800 (CST)	[thread overview]
Message-ID: <4c6df8ce.1812.1a148c207d4.Coremail.19888972804@163.com> (raw)
In-Reply-To: <20261016141249.2791819-3-yaojiale02@163.com>

At 2026-10-16 22:12:48, "Jiale Yao" <yaojiale02@163.com> wrote:
>The PLIC and APLIC MADT callbacks cast generic subtable headers to
>fixed-size records before checking that the complete records are
>present. Truncated firmware entries can therefore cause out-of-bounds
>field reads.
>
>Reject entries that do not contain the complete controller-specific
>structure before registering an interrupt controller.
>

Fixes: e77b8dc02a1c ("ACPI: RISC-V: Initialize GSI mapping structures")

>Signed-off-by: Jiale Yao <yaojiale02@163.com>
>---
> drivers/acpi/riscv/irq.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/drivers/acpi/riscv/irq.c b/drivers/acpi/riscv/irq.c
>index da2c42e0ebfd..1f6fee5c5746 100644
>--- a/drivers/acpi/riscv/irq.c
>+++ b/drivers/acpi/riscv/irq.c
>@@ -220,6 +220,9 @@ static int __init riscv_acpi_aplic_parse_madt(union acpi_subtable_headers *heade
> {
> 	struct acpi_madt_aplic *aplic = (struct acpi_madt_aplic *)header;
> 
>+	if (BAD_MADT_ENTRY(aplic, end))
>+		return -EINVAL;
>+
> 	return riscv_acpi_register_ext_intc(aplic->gsi_base, aplic->num_sources, aplic->num_idcs,
> 					    aplic->id, ACPI_RISCV_IRQCHIP_APLIC);
> }
>@@ -229,6 +232,9 @@ static int __init riscv_acpi_plic_parse_madt(union acpi_subtable_headers *header
> {
> 	struct acpi_madt_plic *plic = (struct acpi_madt_plic *)header;
> 
>+	if (BAD_MADT_ENTRY(plic, end))
>+		return -EINVAL;
>+
> 	return riscv_acpi_register_ext_intc(plic->gsi_base, plic->num_irqs, 0,
> 					    plic->id, ACPI_RISCV_IRQCHIP_PLIC);
> }
>-- 
>2.34.1

      reply	other threads:[~2026-10-17  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 14:12 [PATCH 0/2] RISC-V: validate ACPI MADT entries before use Jiale Yao
2026-10-16 14:12 ` [PATCH 1/2] riscv: validate RINTC " Jiale Yao
2026-10-17  7:25   ` jiale yao
2026-10-16 14:12 ` [PATCH 2/2] ACPI: riscv: validate interrupt controller MADT entries Jiale Yao
2026-10-17  7:27   ` jiale yao [this message]

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=4c6df8ce.1812.1a148c207d4.Coremail.19888972804@163.com \
    --to=19888972804@163.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sunilvl@ventanamicro.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

all inboxes | Powered by JetHome®