intel-iommu: Fix oops with intel_iommu=igfx_off

commit 44cd613c0e 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>
This commit is contained in:
David Woodhouse
2009-12-02 10:18:30 +00:00
committed by Greg Kroah-Hartman
parent 39035f9c09
commit 020d1eecf3

View 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;