linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: irq/core] genirq: Check irq_data_get_irq_chip() return value before use
@ 2020-05-28 14:03 tip-bot2 for Marek Vasut
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Marek Vasut @ 2020-05-28 14:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Marek Vasut, Thomas Gleixner, x86, LKML

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

Commit-ID:     1d0326f352bb094771df17f045bdbadff89a43e6
Gitweb:        https://git.kernel.org/tip/1d0326f352bb094771df17f045bdbadff89a43e6
Author:        Marek Vasut <marex@denx.de>
AuthorDate:    Thu, 14 May 2020 02:25:55 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 28 May 2020 15:58:04 +02:00

genirq: Check irq_data_get_irq_chip() return value before use

irq_data_get_irq_chip() can return NULL, however it is expected that this
never happens. If a buggy driver leads to NULL being returned from
irq_data_get_irq_chip(), warn about it instead of crashing the machine.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

To: linux-arm-kernel@lists.infradead.org
---
 kernel/irq/manage.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 453a8a0..7619111 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2619,6 +2619,8 @@ int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state which,
 
 	do {
 		chip = irq_data_get_irq_chip(data);
+		if (WARN_ON_ONCE(!chip))
+			return -ENODEV;
 		if (chip->irq_get_irqchip_state)
 			break;
 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
@@ -2696,6 +2698,8 @@ 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 (chip->irq_set_irqchip_state)
 			break;
 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY

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

only message in thread, other threads:[~2020-05-28 14:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 14:03 [tip: irq/core] genirq: Check irq_data_get_irq_chip() return value before use tip-bot2 for Marek Vasut

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