[PATCH v2 5/6] irqchip/loongarch-cpu: validate MADT LIO-PIC entries

From: Jiale Yao

Date: Wed Oct 21 2026 - 10:47:00 EST


The LIO-PIC MADT callback passes a typed record to the controller
initialization code without checking that the complete record is
present. A truncated firmware entry can therefore lead to out-of-bounds
field reads.

Reject incomplete LIO-PIC entries before passing them to the
initialization helper.

Fixes: b2d3e3354e2a ("irqchip: Add LoongArch CPU interrupt controller support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
drivers/irqchip/irq-loongarch-cpu.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c
index 84ce24889488..6185825477f4 100644
--- a/drivers/irqchip/irq-loongarch-cpu.c
+++ b/drivers/irqchip/irq-loongarch-cpu.c
@@ -119,6 +119,9 @@ static int __init liointc_parse_madt(union acpi_subtable_headers *header,
{
struct acpi_madt_lio_pic *liointc_entry = (struct acpi_madt_lio_pic *)header;

+ if (BAD_MADT_ENTRY(liointc_entry, end))
+ return -EINVAL;
+
return liointc_acpi_init(irq_domain, liointc_entry);
}

--
2.34.1