]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 9 Dec 2025 06:54:16 +0000 (09:54 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 10 Dec 2025 03:11:06 +0000 (12:11 +0900)
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 <dan.carpenter@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://patch.msgid.link/aTfHmOz6IBpTIPU5@stanley.mountain
drivers/irqchip/irq-mchp-eic.c

index 2474fa467a059ed007133c4ffb86e79dc68a7f69..31093a8ab67c3acaab95e202477ff27ba5a0e94e 100644 (file)
@@ -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: