On Tue, 2014-03-25 at 20:30 +0100, Joerg Roedel wrote:
> 
> When ir_dev_scope_init() is called via a rootfs initcall it
> will check for irq_remapping_enabled before it calls
> (indirectly) into dmar_acpi_dev_scope_init() which uses the
> dmar_tbl pointer without any checks.

Ew. If irq_remapping_enabled is not (any more?) Intel-specific, then
ir_dev_scope_init() ought to be checking something more appropriate.

But defensively fixing dmar_dev_scope_init() as you have done certainly
seems reasonable. On a slow path, it doesn't hurt to check for NULL.

Acked-by: David Woodhouse <david.woodho...@intel.com>


However, I note that dmar_dev_scope_init() already *does* effectively
check for the existence of Intel IOMMU hardware, because it checks the
dmar_drhd_units list. So the patch below would also make sense, and
should be sufficient to fix the problem on its own...



From: David Woodhouse <david.woodho...@intel.com>
Subject: iommu/vt-d: Only call dmar_acpi_dev_scope_init() if there are DRHD 
units

For arcane reasons, this code path gets exercised even on AMD systems
when IRQ remapping is enabled.

Signed-off-by: David Woodhouse <david.woodho...@intel.com>

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 56e1c79..8e1a4ae 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -693,13 +693,13 @@ int __init dmar_dev_scope_init(void)
        if (dmar_dev_scope_status != 1)
                return dmar_dev_scope_status;
 
-       dmar_acpi_dev_scope_init();
-
        if (list_empty(&dmar_drhd_units)) {
                dmar_dev_scope_status = -ENODEV;
        } else {
                dmar_dev_scope_status = 0;
 
+               dmar_acpi_dev_scope_init();
+
                for_each_pci_dev(dev) {
                        if (dev->is_virtfn)
                                continue;



-- 
David Woodhouse                            Open Source Technology Centre
david.woodho...@intel.com                              Intel Corporation

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to