stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [patch 1/7] genirq/debugfs: Add missing sanity checks to interrupt injection
       [not found] ` <20200306130623.500019114@linutronix.de>
@ 2020-03-06 13:15   ` Marc Zyngier
  2020-03-07 23:20   ` Sasha Levin
  2020-03-08 10:14   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
  2 siblings, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2020-03-06 13:15 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, x86, Bjorn Helgaas, linux-pci, Keith Busch,
	Kuppuswamy Sathyanarayanan, stable

On 2020-03-06 13:03, Thomas Gleixner wrote:
> 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@linutronix.de>
> Cc: stable@vger.kernel.org
> ---
>  kernel/irq/debugfs.c |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> --- a/kernel/irq/debugfs.c
> +++ b/kernel/irq/debugfs.c
> @@ -206,8 +206,15 @@ static ssize_t irq_debug_write(struct fi
>  		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;

Huh, nice catch.

Acked-by: Marc Zyngier <maz@kernel.org>

         M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/7] genirq/debugfs: Add missing sanity checks to interrupt injection
       [not found] ` <20200306130623.500019114@linutronix.de>
  2020-03-06 13:15   ` [patch 1/7] genirq/debugfs: Add missing sanity checks to interrupt injection Marc Zyngier
@ 2020-03-07 23:20   ` Sasha Levin
  2020-03-08 10:14   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
  2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2020-03-07 23:20 UTC (permalink / raw)
  To: Sasha Levin, Thomas Gleixner, LKML; +Cc: Marc Zyngier, x86, stable, stable

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: 536e2e34bd00 ("genirq/debugfs: Triggering of interrupts from userspace").

The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172.

v5.5.8: Build failed! Errors:
    kernel/irq/debugfs.c:217:48: error: expected ‘)’ before ‘{’ token
    kernel/irq/debugfs.c:229:2: error: expected expression before ‘}’ token

v5.4.24: Build failed! Errors:
    kernel/irq/debugfs.c:217:48: error: expected ‘)’ before ‘{’ token
    kernel/irq/debugfs.c:229:2: error: expected expression before ‘}’ token

v4.19.108: Failed to apply! Possible dependencies:
    b525903c254d ("genirq: Provide basic NMI management for interrupt lines")

v4.14.172: Failed to apply! Possible dependencies:
    6988e0e0d283 ("genirq/msi: Limit level-triggered MSI to platform devices")
    72a8edc2d913 ("genirq/debugfs: Add missing IRQCHIP_SUPPORTS_LEVEL_MSI debug")
    b525903c254d ("genirq: Provide basic NMI management for interrupt lines")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: irq/core] genirq/debugfs: Add missing sanity checks to interrupt injection
       [not found] ` <20200306130623.500019114@linutronix.de>
  2020-03-06 13:15   ` [patch 1/7] genirq/debugfs: Add missing sanity checks to interrupt injection Marc Zyngier
  2020-03-07 23:20   ` Sasha Levin
@ 2020-03-08 10:14   ` tip-bot2 for Thomas Gleixner
  2 siblings, 0 replies; 3+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2020-03-08 10:14 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Thomas Gleixner, Marc Zyngier, stable, x86, LKML

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@linutronix.de>
AuthorDate:    Fri, 06 Mar 2020 14:03:42 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.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@linutronix.de>
Acked-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-08 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200306130341.199467200@linutronix.de>
     [not found] ` <20200306130623.500019114@linutronix.de>
2020-03-06 13:15   ` [patch 1/7] genirq/debugfs: Add missing sanity checks to interrupt injection Marc Zyngier
2020-03-07 23:20   ` Sasha Levin
2020-03-08 10:14   ` [tip: irq/core] " tip-bot2 for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).