Prevent oops at boot with VT-d
authorDirk Hohndel <hohndel@linux.intel.com>
Sun, 11 Jan 2009 15:33:51 +0000 (15:33 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 Jan 2009 16:03:46 +0000 (08:03 -0800)
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 <hohndel@linux.intel.com>
Acked-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pci/intel-iommu.c

index 235fb7a5a8a50455fcbf27a64ff8b84f6e418882..3dfecb20d5e7949953e7fefa2796af4b48bef88f 100644 (file)
@@ -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;