x86/irq: Prevent force migration of irqs which are not in the vector domain
[deliverable/linux.git] / arch / x86 / kernel / apic / vector.c
index 6066d945c40e3a280f229ea54a51fdf8e88d53b8..5d30c5e42bb13939b9164ac575d9202a26d772a7 100644 (file)
@@ -661,11 +661,28 @@ void irq_complete_move(struct irq_cfg *cfg)
  */
 void irq_force_complete_move(struct irq_desc *desc)
 {
-       struct irq_data *irqdata = irq_desc_get_irq_data(desc);
-       struct apic_chip_data *data = apic_chip_data(irqdata);
-       struct irq_cfg *cfg = data ? &data->cfg : NULL;
+       struct irq_data *irqdata;
+       struct apic_chip_data *data;
+       struct irq_cfg *cfg;
        unsigned int cpu;
 
+       /*
+        * The function is called for all descriptors regardless of which
+        * irqdomain they belong to. For example if an IRQ is provided by
+        * an irq_chip as part of a GPIO driver, the chip data for that
+        * descriptor is specific to the irq_chip in question.
+        *
+        * Check first that the chip_data is what we expect
+        * (apic_chip_data) before touching it any further.
+        */
+       irqdata = irq_domain_get_irq_data(x86_vector_domain,
+                                         irq_desc_get_irq(desc));
+       if (!irqdata)
+               return;
+
+       data = apic_chip_data(irqdata);
+       cfg = data ? &data->cfg : NULL;
+
        if (!cfg)
                return;
 
This page took 0.026081 seconds and 5 git commands to generate.