x86: Fix NULL pointer access in irq_force_complete_move() for Xen guests
[deliverable/linux.git] / arch / x86 / kernel / apic / io_apic.c
index e4e0ddcb1546bde04f0d01675756622b9d2434bd..eb2789c3f7216a43eb4017e44fed32556a703918 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/freezer.h>
 #include <linux/kthread.h>
 #include <linux/jiffies.h>     /* time_after() */
+#include <linux/slab.h>
 #ifdef CONFIG_ACPI
 #include <acpi/acpi_bus.h>
 #endif
@@ -1268,6 +1269,14 @@ void __setup_vector_irq(int cpu)
        /* Mark the inuse vectors */
        for_each_irq_desc(irq, desc) {
                cfg = desc->chip_data;
+
+               /*
+                * If it is a legacy IRQ handled by the legacy PIC, this cpu
+                * will be part of the irq_cfg's domain.
+                */
+               if (irq < legacy_pic->nr_legacy_irqs && !IO_APIC_IRQ(irq))
+                       cpumask_set_cpu(cpu, cfg->domain);
+
                if (!cpumask_test_cpu(cpu, cfg->domain))
                        continue;
                vector = cfg->vector;
@@ -2536,6 +2545,9 @@ void irq_force_complete_move(int irq)
        struct irq_desc *desc = irq_to_desc(irq);
        struct irq_cfg *cfg = desc->chip_data;
 
+       if (!cfg)
+               return;
+
        __irq_complete_move(&desc, cfg->vector);
 }
 #else
This page took 0.027577 seconds and 5 git commands to generate.