mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiale Yao <yaojiale02@163.com>
To: Huacai Chen <chenhuacai@kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	Marc Zyngier <maz@kernel.org>, Jianmin Lv <lvjianmin@loongson.cn>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH v2 06/20] irqchip/loongson-eiointc: validate MADT BIO-PIC entries
Date: Thu, 29 Oct 2026 11:52:37 +0800	[thread overview]
Message-ID: <20261029035253.2333852-7-yaojiale02@163.com> (raw)
In-Reply-To: <20261029035253.2333852-1-yaojiale02@163.com>

The BIO-PIC MADT callback reads the controller address before checking
that firmware supplied the complete fixed-size record. A truncated entry
can therefore cause an out-of-bounds read while selecting the parent
domain.

Validate the BIO-PIC record before accessing its address or passing it
to the initialization helper.

Fixes: dd281e1a1a93 ("irqchip: Add Loongson Extended I/O interrupt controller support")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/irqchip/irq-loongson-eiointc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
index ba6e8480e383..1b90edef5a52 100644
--- a/drivers/irqchip/irq-loongson-eiointc.c
+++ b/drivers/irqchip/irq-loongson-eiointc.c
@@ -454,8 +454,14 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header,
 					const unsigned long end)
 {
 	struct acpi_madt_bio_pic *pchpic_entry = (struct acpi_madt_bio_pic *)header;
-	unsigned int node = pa_to_nid(pchpic_entry->address) & 0xf;
-	struct irq_domain *parent = acpi_get_vec_parent(node, pch_group);
+	struct irq_domain *parent;
+	unsigned int node;
+
+	if (BAD_MADT_ENTRY(pchpic_entry, end))
+		return -EINVAL;
+
+	node = pa_to_nid(pchpic_entry->address) & 0xf;
+	parent = acpi_get_vec_parent(node, pch_group);
 
 	if (parent)
 		return pch_pic_acpi_init(parent, pchpic_entry);
-- 
2.34.1


  parent reply	other threads:[~2026-10-29  3:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  3:52 [PATCH v2 00/20] ACPI/irqchip: validate MADT entries before use Jiale Yao
2026-10-29  3:52 ` [PATCH v2 01/20] ACPI: irqchip: validate MADT entry bounds before probing Jiale Yao
2026-11-03 14:44   ` Lorenzo Pieralisi
2026-11-03 16:56     ` Rafael J. Wysocki (Intel)
2026-10-29  3:52 ` [PATCH v2 02/20] irqchip/gic-v3-its: validate MADT ITS entries Jiale Yao
2026-10-29  3:52 ` [PATCH v2 03/20] irqchip/gic-v3: validate MADT records before use Jiale Yao
2026-10-29  3:52 ` [PATCH v2 04/20] irqchip/gic-v5-its: validate MADT translate frames Jiale Yao
2026-10-29  3:52 ` [PATCH v2 05/20] irqchip/loongarch-cpu: validate MADT LIO-PIC entries Jiale Yao
2026-10-29  3:52 ` Jiale Yao [this message]
2026-10-29  3:52 ` [PATCH v2 07/20] riscv: validate RINTC entries before use Jiale Yao
2026-10-29  3:52 ` [PATCH v2 08/20] ACPI: riscv: validate interrupt controller MADT entries Jiale Yao
2026-10-29  3:52 ` [PATCH v2 09/20] riscv: acpi: validate RINTC entries before use Jiale Yao
2026-10-29  3:52 ` [PATCH v2 10/20] irqchip/gic-v5-irs: validate MADT GICC entries Jiale Yao
2026-11-02 14:23 ` [PATCH v2 00/20] ACPI/irqchip: validate MADT entries before use Huacai Chen

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=20261029035253.2333852-7-yaojiale02@163.com \
    --to=yaojiale02@163.com \
    --cc=chenhuacai@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lvjianmin@loongson.cn \
    --cc=maz@kernel.org \
    --cc=radu@rendec.net \
    --cc=stable@vger.kernel.org \
    --cc=tglx@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

all inboxes | Powered by JetHome®