From: Pengpeng Hou <hppiscas@163.com>
To: mark-pk.tsai@mediatek.com
Cc: daniel@thingy.jp, tglx@kernel.org, radu@rendec.net,
linux-kernel@vger.kernel.org, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, hppiscas@163.com
Subject: [PATCH v2] irqchip/mst-intc: validate the DT interrupt range
Date: Sun, 20 Sep 2026 11:42:36 +0800 [thread overview]
Message-ID: <20260920034236.16229-1-hppiscas@163.com> (raw)
The driver takes an inclusive interrupt range from the device tree
without checking its endpoints. A reversed range wraps the unsigned
count calculation, and a range larger than MST_INTC_MAX_IRQS exceeds the
controller capacity used by the driver.
Reject these ranges before calculating nr_irqs or creating the domain.
Check the difference after ordering the endpoints so the validation
itself cannot wrap.
The issue was found by our static-analysis tool.
Fixes: ad4c938c92af ("irqchip/irq-mst: Add MStar interrupt controller support")
Reviewed-by: Radu Rendec <radu@rendec.net>
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
Changes since v1:
https://lore.kernel.org/all/20260722041443.10020-1-pengpeng@iscas.ac.cn/
Describe the missing DT range validation directly, keep the condition on
one line, and add the introducing Fixes tag as Thomas requested.
drivers/irqchip/irq-mst-intc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/irqchip/irq-mst-intc.c b/drivers/irqchip/irq-mst-intc.c
index b5335f6fd6d6..1070de5de8cc 100644
--- a/drivers/irqchip/irq-mst-intc.c
+++ b/drivers/irqchip/irq-mst-intc.c
@@ -263,6 +263,9 @@ static int __init mst_intc_of_init(struct device_node *dn,
of_property_read_u32_index(dn, "mstar,irqs-map-range", 1, &irq_end))
return -EINVAL;
+ if (irq_end < irq_start || irq_end - irq_start >= MST_INTC_MAX_IRQS)
+ return -EINVAL;
+
cd = kzalloc_obj(*cd);
if (!cd)
return -ENOMEM;
base-commit: 518e5b794c06c0f0eb40df3e202274a66202c137
--
2.50.1 (Apple Git-155)
reply other threads:[~2026-09-20 3:43 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=20260920034236.16229-1-hppiscas@163.com \
--to=hppiscas@163.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=daniel@thingy.jp \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mark-pk.tsai@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=radu@rendec.net \
--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®