x86/irq: Validate that irq descriptor is still active
authorThomas Gleixner <[email protected]>
Thu, 31 Dec 2015 16:30:45 +0000 (16:30 +0000)
committerThomas Gleixner <[email protected]>
Fri, 15 Jan 2016 12:43:59 +0000 (13:43 +0100)
In fixup_irqs() we unconditionally dereference the irq chip of an irq
descriptor. The descriptor might still be valid, but already cleaned up,
i.e. the chip removed. Add a check for this condition.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Jiang Liu <[email protected]>
Cc: Joe Lawrence <[email protected]>
Cc: Jeremiah Mahler <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: [email protected]
Cc: Guenter Roeck <[email protected]>
Cc: [email protected] #4.3+
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
arch/x86/kernel/irq.c

index f8062aaf5df9c830ec287f6774ad270e13d34b32..c0b58dd1ca042fd853e5c23198f118d8c5b28261 100644 (file)
@@ -470,6 +470,15 @@ void fixup_irqs(void)
                }
 
                chip = irq_data_get_irq_chip(data);
+               /*
+                * The interrupt descriptor might have been cleaned up
+                * already, but it is not yet removed from the radix tree
+                */
+               if (!chip) {
+                       raw_spin_unlock(&desc->lock);
+                       continue;
+               }
+
                if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
                        chip->irq_mask(data);