genirq/debugfs: Add missing sanity checks to interrupt injection
commita740a423c3
upstream. Interrupts cannot be injected when the interrupt is not activated and when a replay is already in progress. Fixes:536e2e34bd
("genirq/debugfs: Triggering of interrupts from userspace") Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Marc Zyngier <maz@kernel.org> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20200306130623.500019114@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6ecc37daf6
commit
3f3700c469
|
@ -206,8 +206,15 @@ static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,
|
||||||
chip_bus_lock(desc);
|
chip_bus_lock(desc);
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
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;
|
err = -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
desc->istate |= IRQS_PENDING;
|
desc->istate |= IRQS_PENDING;
|
||||||
|
|
Loading…
Reference in New Issue