From: David Woodhouse Date: Tue, 5 May 2009 08:25:26 +0000 (+0100) Subject: intel-iommu: Fix oops in device_to_iommu() when devices not found. X-Git-Tag: v2.6.29.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4392e8b0e6ee266a19f6db90c4d56d267a58b4f;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index efc7c12c805ae..7e4f9e661f06c 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;