intel-iommu: Fix oops with intel_iommu=igfx_off
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 2 Dec 2009 10:18:30 +0000 (10:18 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 18 Dec 2009 22:05:57 +0000 (14:05 -0800)
commit 44cd613c0e4cd93079ea2a93aa06649d8ca0830a upstream.

The hotplug notifier will call find_domain() to see if the device in
question has been assigned an IOMMU domain. However, this should never
be called for devices with a "dummy" domain, such as graphics devices
when intel_iommu=igfx_off is set and the corresponding IOMMU isn't even
initialised. If you do that, it'll oops as it dereferences the (-1)
pointer.

The notifier function should check iommu_no_mapping() for the
device before doing anything else.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/intel-iommu.c

index 1db5b037edbc3bdb66cc2b0891a38c65c79ac906..1b9f76f0193a14e1f3dfa72b5042beef1e36289b 100644 (file)
@@ -3238,6 +3238,9 @@ static int device_notifier(struct notifier_block *nb,
        struct pci_dev *pdev = to_pci_dev(dev);
        struct dmar_domain *domain;
 
+       if (iommu_no_mapping(dev))
+               return 0;
+
        domain = find_domain(pdev);
        if (!domain)
                return 0;