Prechádzať zdrojové kódy

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
Alexandru Moise 8 rokov pred
rodič
commit
2827a418ca
1 zmenil súbory, kde vykonal 4 pridanie a 0 odobranie
  1. 4 0
      kernel/irq/manage.c

+ 4 - 0
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;