summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Moise <00moses.alexander00@gmail.com>2017-09-19 22:04:12 +0200
committerThomas Gleixner <tglx@linutronix.de>2017-09-25 16:40:31 +0200
commit2827a418ca1b23e432e62c9b3d0e7cf3255dfe88 (patch)
treef714a36e5dccc31387bc54c7162ce6e8a2fb2f22
parente19b205be43d11bff638cad4487008c48d21c103 (diff)
genirq: Check __free_irq() return value for NULL
__free_irq() can return a NULL irqaction for example when trying to free already-free IRQ, but the callsite unconditionally dereferences the returned pointer. Fix this by adding a check and return NULL. Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20170919200412.GA29985@gmail.com
-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 573dc52b0806..d00132b5c325 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1643,6 +1643,10 @@ const void *free_irq(unsigned int irq, void *dev_id)
#endif
action = __free_irq(irq, dev_id);
+
+ if (!action)
+ return NULL;
+
devname = action->name;
kfree(action);
return devname;