Skip to content

Commit f107cee

Browse files
groeckKAGA-KOKO
authored andcommitted
genirq: Unlock irq descriptor after errors
In irq_set_irqchip_state(), the irq descriptor is not unlocked after an error is encountered. While that should never happen in practice, a buggy driver may trigger it. This would result in a lockup, so fix it. Fixes: 1d0326f ("genirq: Check irq_data_get_irq_chip() return value before use") Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent e27b163 commit f107cee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

kernel/irq/manage.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,8 +2731,10 @@ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
27312731

27322732
do {
27332733
chip = irq_data_get_irq_chip(data);
2734-
if (WARN_ON_ONCE(!chip))
2735-
return -ENODEV;
2734+
if (WARN_ON_ONCE(!chip)) {
2735+
err = -ENODEV;
2736+
goto out_unlock;
2737+
}
27362738
if (chip->irq_set_irqchip_state)
27372739
break;
27382740
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
@@ -2745,6 +2747,7 @@ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
27452747
if (data)
27462748
err = chip->irq_set_irqchip_state(data, which, val);
27472749

2750+
out_unlock:
27482751
irq_put_desc_busunlock(desc, flags);
27492752
return err;
27502753
}

0 commit comments

Comments
 (0)