Skip to content

Commit

Permalink
intel-iommu: Fix oops in device_to_iommu() when devices not found.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Apr 6, 2009
1 parent 276dbf9 commit 4958c5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4958c5d

Please sign in to comment.