Skip to content

Commit 75a0618

Browse files
committed
genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD
The resend mechanism happily calls the interrupt handler of interrupts which are marked IRQ_NESTED_THREAD from softirq context. This can result in crashes because the interrupt handler is not the proper way to invoke the device handlers. They must be invoked via handle_nested_irq. Prevent the resend even if the interrupt has no valid parent irq set. Its better to have a lost interrupt than a crashing machine. Reported-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected]
1 parent ce0d3c0 commit 75a0618

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

kernel/irq/resend.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
7575
!desc->irq_data.chip->irq_retrigger(&desc->irq_data)) {
7676
#ifdef CONFIG_HARDIRQS_SW_RESEND
7777
/*
78-
* If the interrupt has a parent irq and runs
79-
* in the thread context of the parent irq,
80-
* retrigger the parent.
78+
* If the interrupt is running in the thread
79+
* context of the parent irq we need to be
80+
* careful, because we cannot trigger it
81+
* directly.
8182
*/
82-
if (desc->parent_irq &&
83-
irq_settings_is_nested_thread(desc))
83+
if (irq_settings_is_nested_thread(desc)) {
84+
/*
85+
* If the parent_irq is valid, we
86+
* retrigger the parent, otherwise we
87+
* do nothing.
88+
*/
89+
if (!desc->parent_irq)
90+
return;
8491
irq = desc->parent_irq;
92+
}
8593
/* Set it pending and activate the softirq: */
8694
set_bit(irq, irqs_resend);
8795
tasklet_schedule(&resend_tasklet);

0 commit comments

Comments
 (0)