projects/linux·commit 7dbc0d40

irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()

7dbc0d40 · Dan Carpenter <[email protected]> · 2025-12-09 09:54:16 +03:00

If irq_domain_translate_twocell() sets "hwirq" to >= MCHP_EIC_NIRQ (2) then
it results in an out of bounds access.

The code checks for invalid values, but doesn't set the error code.  Return
-EINVAL in that case, instead of returning success.

Fixes: 00fa3461c86d ("irqchip/mchp-eic: Add support for the Microchip EIC")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
Link: https://patch.msgid.link/[email protected]
Commit
7dbc0d40d8347bd9de55c904f59ea44bcc8dedb7
Parents
55026a96

Changes

1 files changed · +1 −1

FileStatusAddDelContent
drivers/irqchip/irq-mchp-eic.cmodified+1−1View file

drivers/irqchip/irq-mchp-eic.c

View file
diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c
index 2474fa4..31093a8 100644
--- a/drivers/irqchip/irq-mchp-eic.c
+++ b/drivers/irqchip/irq-mchp-eic.c
@@ -170,7 +170,7 @@ static int mchp_eic_domain_alloc(struct irq_domain *domain, unsigned int virq,
ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
if (ret || hwirq >= MCHP_EIC_NIRQ)
- return ret;
+ return ret ?: -EINVAL;
switch (type) {
case IRQ_TYPE_EDGE_RISING: