aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-04-06 16:30:01 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-04-06 16:30:01 -0400
commit4958c5dc7bcb2e42d985cd26aeafd8a7eca9ab1e (patch)
tree7bad2dac396fef6cca7f72132078a30e912b2589 /drivers/pci/intel-iommu.c
parent276dbf997043cbf38f0087624e0f9c51742c8885 (diff)
intel-iommu: Fix oops in device_to_iommu() when devices not found.
It's possible for a device in the drhd->devices[] array to be NULL if it wasn't found at boot time, which means we have to check for that case. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index fd7472f28674..dcda5212f3bb 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -485,7 +485,8 @@ static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn)
485 drhd->devices[i]->bus->number == bus && 485 drhd->devices[i]->bus->number == bus &&
486 drhd->devices[i]->devfn == devfn) 486 drhd->devices[i]->devfn == devfn)
487 return drhd->iommu; 487 return drhd->iommu;
488 if (drhd->devices[i]->subordinate && 488 if (drhd->devices[i] &&
489 drhd->devices[i]->subordinate &&
489 drhd->devices[i]->subordinate->number <= bus && 490 drhd->devices[i]->subordinate->number <= bus &&
490 drhd->devices[i]->subordinate->subordinate >= bus) 491 drhd->devices[i]->subordinate->subordinate >= bus)
491 return drhd->iommu; 492 return drhd->iommu;