[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158366247101.28353.9070665399389100228.tip-bot2@tip-bot2>
Date: Sun, 08 Mar 2020 10:14:31 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>, stable@...r.kernel.org,
x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [tip: irq/core] genirq/debugfs: Add missing sanity checks to
interrupt injection
The following commit has been merged into the irq/core branch of tip:
Commit-ID: a740a423c36932695b01a3e920f697bc55b05fec
Gitweb: https://git.kernel.org/tip/a740a423c36932695b01a3e920f697bc55b05fec
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Fri, 06 Mar 2020 14:03:42 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Sun, 08 Mar 2020 11:06:40 +01:00
genirq/debugfs: Add missing sanity checks to interrupt injection
Interrupts cannot be injected when the interrupt is not activated and when
a replay is already in progress.
Fixes: 536e2e34bd00 ("genirq/debugfs: Triggering of interrupts from userspace")
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Marc Zyngier <maz@...nel.org>
Cc: stable@...r.kernel.org
Link: https://lkml.kernel.org/r/20200306130623.500019114@linutronix.de
---
kernel/irq/debugfs.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index a949bd3..d44c8fd 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -206,8 +206,15 @@ static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,
chip_bus_lock(desc);
raw_spin_lock_irqsave(&desc->lock, flags);
- if (irq_settings_is_level(desc) || desc->istate & IRQS_NMI) {
- /* Can't do level nor NMIs, sorry */
+ /*
+ * Don't allow injection when the interrupt is:
+ * - Level or NMI type
+ * - not activated
+ * - replaying already
+ */
+ if (irq_settings_is_level(desc) ||
+ !irqd_is_activated(&desc->irq_data) ||
+ (desc->istate & (IRQS_NMI | IRQS_REPLAY))) {
err = -EINVAL;
} else {
desc->istate |= IRQS_PENDING;
Powered by blists - more mailing lists