summaryrefslogtreecommitdiff
path: root/kernel/irq/resend.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-03-06 16:03:43 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-03-08 13:06:40 +0300
commitc16816acd08697b02a53f56f8936497a9f6f6e7a (patch)
treeb1862c5ad099bf0324e042dd2984f6730795472a /kernel/irq/resend.c
parenta740a423c36932695b01a3e920f697bc55b05fec (diff)
downloadlinux-c16816acd08697b02a53f56f8936497a9f6f6e7a.tar.xz
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);