stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: irq/urgent] genirq: Unlock irq descriptor after errors
       [not found] <20200811180012.80269-1-linux@roeck-us.net>
@ 2020-08-13  7:42 ` tip-bot2 for Guenter Roeck
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Guenter Roeck @ 2020-08-13  7:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Guenter Roeck, Thomas Gleixner, stable, x86, LKML

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     f107cee94ba4d2c7357fde59a1d84346c73d4958
Gitweb:        https://git.kernel.org/tip/f107cee94ba4d2c7357fde59a1d84346c73d4958
Author:        Guenter Roeck <linux@roeck-us.net>
AuthorDate:    Tue, 11 Aug 2020 11:00:12 -07:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 13 Aug 2020 09:35:59 +02:00

genirq: Unlock irq descriptor after errors

In irq_set_irqchip_state(), the irq descriptor is not unlocked after an
error is encountered. While that should never happen in practice, a buggy
driver may trigger it. This would result in a lockup, so fix it.

Fixes: 1d0326f352bb ("genirq: Check irq_data_get_irq_chip() return value before use")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200811180012.80269-1-linux@roeck-us.net

---
 kernel/irq/manage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index d55ba62..52ac539 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2731,8 +2731,10 @@ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
 
 	do {
 		chip = irq_data_get_irq_chip(data);
-		if (WARN_ON_ONCE(!chip))
-			return -ENODEV;
+		if (WARN_ON_ONCE(!chip)) {
+			err = -ENODEV;
+			goto out_unlock;
+		}
 		if (chip->irq_set_irqchip_state)
 			break;
 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
@@ -2745,6 +2747,7 @@ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
 	if (data)
 		err = chip->irq_set_irqchip_state(data, which, val);
 
+out_unlock:
 	irq_put_desc_busunlock(desc, flags);
 	return err;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-13  7:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200811180012.80269-1-linux@roeck-us.net>
2020-08-13  7:42 ` [tip: irq/urgent] genirq: Unlock irq descriptor after errors tip-bot2 for Guenter Roeck

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).