From: David Woodhouse Date: Mon, 6 Apr 2009 20:30:01 +0000 (-0700) Subject: intel-iommu: Fix oops in device_to_iommu() when devices not found. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4958c5dc7bcb2e42d985cd26aeafd8a7eca9ab1e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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) 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;