2017-09-19 20:04:24

by Alexandru Moise

[permalink] [raw]
Subject: [PATCH] genirq: check __free_irq()'s return value for NULL

__free_irq() can return a NULL irqaction for example when trying to
free already-free IRQ. Fix this by adding a check and return NULL.

Signed-off-by: Alexandru Moise <[email protected]>
---
kernel/irq/manage.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 573dc52b0806..649bc34521da 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;
--
2.14.1