irqchip/mst-intc: validate the DT interrupt range
Subsystems (3)
PATCH v2 1/1 irqchip/mst-intc: validate the DT interrupt range
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.
---
Changes since v1:
https://lore.kernel.org/all/[email protected]/
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(+)
drivers/irqchip/irq-mst-intc.c +3 -0
@@ -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
Signature · 1 line
2.50.1 (Apple Git-155)
[tip: irq/drivers] irqchip/mst-intc: Validate the DT interrupt range
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 16f25d326e5d3b9fd51bc5e3916ecbffbca63e7b Gitweb: https://git.kernel.org/tip/16f25d326e5d3b9fd51bc5e3916ecbffbca63e7b Author: Pengpeng Hou <[email protected]> AuthorDate: Sun, 20 Sep 2026 11:42:36 +08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 15 Oct 2026 11:50:47 +02:00
irqchip/mst-intc: Validate the DT interrupt range
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.
--- drivers/irqchip/irq-mst-intc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/irqchip/irq-mst-intc.c +3 -0
@@ -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 ;