iommu/dma: Don't touch invalid iova_domain members
[linux-block.git] / drivers / iommu / intel_irq_remapping.c
index ac596928f6b40af32e9c44ecf388ebf7ed4b10ed..a190cbd76ef7113f850b3c09d8b513367d7eb496 100644 (file)
@@ -408,14 +408,6 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
        size_t size;
        u64 irta;
 
-       if (!is_kdump_kernel()) {
-               pr_warn("IRQ remapping was enabled on %s but we are not in kdump mode\n",
-                       iommu->name);
-               clear_ir_pre_enabled(iommu);
-               iommu_disable_irq_remapping(iommu);
-               return -EINVAL;
-       }
-
        /* Check whether the old ir-table has the same size as ours */
        irta = dmar_readq(iommu->reg + DMAR_IRTA_REG);
        if ((irta & INTR_REMAP_TABLE_REG_SIZE_MASK)
@@ -567,7 +559,12 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
        init_ir_status(iommu);
 
        if (ir_pre_enabled(iommu)) {
-               if (iommu_load_old_irte(iommu))
+               if (!is_kdump_kernel()) {
+                       pr_warn("IRQ remapping was enabled on %s but we are not in kdump mode\n",
+                               iommu->name);
+                       clear_ir_pre_enabled(iommu);
+                       iommu_disable_irq_remapping(iommu);
+               } else if (iommu_load_old_irte(iommu))
                        pr_err("Failed to copy IR table for %s from previous kernel\n",
                               iommu->name);
                else