[PATCH v2 09/20] riscv: acpi: validate RINTC entries before use
Jiale Yao
yaojiale02 at 163.com
Wed Oct 28 20:52:40 PDT 2026
The RINTC callback reads flags and other fields from a typed MADT record
without checking that the complete record is present. A truncated
firmware entry can therefore cause out-of-bounds reads during CPU map
initialization.
Reject incomplete RINTC entries before accessing typed fields.
Fixes: f99561199470 ("RISC-V: ACPI: Cache and retrieve the RINTC structure")
Cc: stable at vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02 at 163.com>
---
arch/riscv/kernel/acpi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index efd52a5d05b5..9e0658c6a869 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -171,6 +171,9 @@ static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsi
struct acpi_madt_rintc *rintc = (struct acpi_madt_rintc *)header;
int cpuid;
+ if (BAD_MADT_ENTRY(rintc, end))
+ return -EINVAL;
+
if (!(rintc->flags & ACPI_MADT_ENABLED))
return 0;
--
2.34.1
More information about the linux-riscv
mailing list