Skip to content

Commit 7dbc0d4

Browse files
Dan CarpenterKAGA-KOKO
authored andcommitted
irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
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: 00fa346 ("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
1 parent 55026a9 commit 7dbc0d4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/irqchip/irq-mchp-eic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int mchp_eic_domain_alloc(struct irq_domain *domain, unsigned int virq,
170170

171171
ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
172172
if (ret || hwirq >= MCHP_EIC_NIRQ)
173-
return ret;
173+
return ret ?: -EINVAL;
174174

175175
switch (type) {
176176
case IRQ_TYPE_EDGE_RISING:

0 commit comments

Comments
 (0)