summaryrefslogtreecommitdiff
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2020-05-14 02:25:55 +0200
committerThomas Gleixner <tglx@linutronix.de>2020-05-28 15:58:04 +0200
commit1d0326f352bb094771df17f045bdbadff89a43e6 (patch)
tree7371c341b51de7df6952adf6d9d5deeb982d83ef /kernel/irq/manage.c
parent9cb1fd0efd195590b828b9b865421ad345a4a145 (diff)
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
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 453a8a0f4804..761911168438 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