]> git.baikalelectronics.ru Git - kernel.git/commitdiff
genirq/PM: Always unlock IRQ descriptor in rearm_wake_irq()
authorGuenter Roeck <linux@roeck-us.net>
Tue, 11 Aug 2020 18:00:01 +0000 (11:00 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 12 Aug 2020 09:04:05 +0000 (11:04 +0200)
rearm_wake_irq() does not unlock the irq descriptor if the interrupt
is not suspended or if wakeup is not enabled on it.

Restucture the exit conditions so the unlock is always ensured.

Fixes: 3a79bc63d9075 ("PCI: irq: Introduce rearm_wake_irq()")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200811180001.80203-1-linux@roeck-us.net
kernel/irq/pm.c

index 8f557fa1f4fe47642dd0782ebf55a7be5a3a0f55..c6c7e187ae7485e631f43147643871158de4ad8c 100644 (file)
@@ -185,14 +185,18 @@ void rearm_wake_irq(unsigned int irq)
        unsigned long flags;
        struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
 
-       if (!desc || !(desc->istate & IRQS_SUSPENDED) ||
-           !irqd_is_wakeup_set(&desc->irq_data))
+       if (!desc)
                return;
 
+       if (!(desc->istate & IRQS_SUSPENDED) ||
+           !irqd_is_wakeup_set(&desc->irq_data))
+               goto unlock;
+
        desc->istate &= ~IRQS_SUSPENDED;
        irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
        __enable_irq(desc);
 
+unlock:
        irq_put_desc_busunlock(desc, flags);
 }