Skip to content

Commit 3f883c3

Browse files
jhovoldMarc Zyngier
authored andcommitted
irqdomain: Fix disassociation race
The global irq_domain_mutex is held when mapping interrupts from non-hierarchical domains but currently not when disposing them. This specifically means that updates of the domain mapcount is racy (currently only used for statistics in debugfs). Make sure to hold the global irq_domain_mutex also when disposing mappings from non-hierarchical domains. Fixes: 9dc6be3 ("genirq/irqdomain: Add map counter") Cc: [email protected] # 4.13 Tested-by: Hsin-Yi Wang <[email protected]> Tested-by: Mark-PK Tsai <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b06730a commit 3f883c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/irq/irqdomain.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,9 @@ static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq)
538538
return;
539539

540540
hwirq = irq_data->hwirq;
541+
542+
mutex_lock(&irq_domain_mutex);
543+
541544
irq_set_status_flags(irq, IRQ_NOREQUEST);
542545

543546
/* remove chip and handler */
@@ -557,6 +560,8 @@ static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq)
557560

558561
/* Clear reverse map for this hwirq */
559562
irq_domain_clear_mapping(domain, hwirq);
563+
564+
mutex_unlock(&irq_domain_mutex);
560565
}
561566

562567
static int irq_domain_associate_locked(struct irq_domain *domain, unsigned int virq,

0 commit comments

Comments
 (0)