Skip to content

Commit 17549b0

Browse files
manfred-colorfuKAGA-KOKO
authored andcommitted
genirq: Add might_sleep() to disable_irq()
With the introduction of threaded interrupt handlers, it is virtually never safe to call disable_irq() from non-premptible context. Thus: Update the documentation, add an explicit might_sleep() to catch any offenders. This is more obvious and straight forward than the implicit might_sleep() check deeper down in the disable_irq() call chain. Fixes: 3aa551c ("genirq: add threaded interrupt handler support") Signed-off-by: Manfred Spraul <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b7bfaa7 commit 17549b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/irq/manage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,13 @@ EXPORT_SYMBOL(disable_irq_nosync);
723723
* to complete before returning. If you use this function while
724724
* holding a resource the IRQ handler may need you will deadlock.
725725
*
726-
* This function may be called - with care - from IRQ context.
726+
* Can only be called from preemptible code as it might sleep when
727+
* an interrupt thread is associated to @irq.
728+
*
727729
*/
728730
void disable_irq(unsigned int irq)
729731
{
732+
might_sleep();
730733
if (!__disable_irq_nosync(irq))
731734
synchronize_irq(irq);
732735
}

0 commit comments

Comments
 (0)