From: Dirk Hohndel Date: Sun, 11 Jan 2009 15:33:51 +0000 (+0000) Subject: Prevent oops at boot with VT-d X-Git-Tag: firefly_0821_release~15878 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=288e4877f94a3b144aadc206e7796921d02432c1;p=firefly-linux-kernel-4.4.55.git Prevent oops at boot with VT-d With some broken BIOSs when VT-d is enabled, the data structures are filled incorrectly. This can cause a NULL pointer dereference in very early boot. Signed-off-by: Dirk Hohndel Acked-by: Yu Zhao Signed-off-by: David Woodhouse Signed-off-by: Linus Torvalds --- diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 235fb7a5a8a5..3dfecb20d5e7 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -438,7 +438,8 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn) continue; for (i = 0; i < drhd->devices_cnt; i++) - if (drhd->devices[i]->bus->number == bus && + if (drhd->devices[i] && + drhd->devices[i]->bus->number == bus && drhd->devices[i]->devfn == devfn) return drhd->iommu;