aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel/irq/resend.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-03-06 14:03:43 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-03-08 11:06:40 +0100
commitc16816acd08697b02a53f56f8936497a9f6f6e7a (patch)
treeb1862c5ad099bf0324e042dd2984f6730795472a /kernel/irq/resend.c
parentgenirq/debugfs: Add missing sanity checks to interrupt injection (diff)
downloadwireguard-linux-c16816acd08697b02a53f56f8936497a9f6f6e7a.tar.xz
wireguard-linux-c16816acd08697b02a53f56f8936497a9f6f6e7a.zip
genirq: Add protection against unsafe usage of generic_handle_irq()
In general calling generic_handle_irq() with interrupts disabled from non interrupt context is harmless. For some interrupt controllers like the x86 trainwrecks this is outright dangerous as it might corrupt state if an interrupt affinity change is pending. Add infrastructure which allows to mark interrupts as unsafe and catch such usage in generic_handle_irq(). Reported-by: sathyanarayanan.kuppuswamy@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lkml.kernel.org/r/20200306130623.590923677@linutronix.de
Diffstat (limited to 'kernel/irq/resend.c')
-rw-r--r--kernel/irq/resend.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index 98c04ca5fa43..5064b13b80d6 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -72,8 +72,9 @@ void check_irq_resend(struct irq_desc *desc)
desc->istate &= ~IRQS_PENDING;
desc->istate |= IRQS_REPLAY;
- if (!desc->irq_data.chip->irq_retrigger ||
- !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) {
+ if ((!desc->irq_data.chip->irq_retrigger ||
+ !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) &&
+ !handle_enforce_irqctx(&desc->irq_data)) {
#ifdef CONFIG_HARDIRQS_SW_RESEND
unsigned int irq = irq_desc_get_irq(desc);