summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2009-05-05 09:25:26 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-05-08 15:45:10 -0700
commita4392e8b0e6ee266a19f6db90c4d56d267a58b4f (patch)
tree3af7e20805aad04325f3f93b7770cb83b9a8a77b /drivers
parentedfbb1affe9454a32cb55c0c77dedac0b60746f5 (diff)
intel-iommu: Fix oops in device_to_iommu() when devices not found.
(cherry picked from commit 4958c5dc7bcb2e42d985cd26aeafd8a7eca9ab1e) 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-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 efc7c12c805a..7e4f9e661f06 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -452,7 +452,8 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn)
drhd->devices[i]->bus->number == bus &&
drhd->devices[i]->devfn == devfn)
return drhd->iommu;
- if (drhd->devices[i]->subordinate &&
+ if (drhd->devices[i] &&
+ drhd->devices[i]->subordinate &&
drhd->devices[i]->subordinate->number <= bus &&
drhd->devices[i]->subordinate->subordinate >= bus)
return drhd->iommu;