Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4958c5dc authored by David Woodhouse's avatar David Woodhouse
Browse files

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: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 276dbf99
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -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]->bus->number == bus &&
			    drhd->devices[i]->devfn == devfn)
			    drhd->devices[i]->devfn == devfn)
				return drhd->iommu;
				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->number <= bus &&
			    drhd->devices[i]->subordinate->subordinate >= bus)
			    drhd->devices[i]->subordinate->subordinate >= bus)
				return drhd->iommu;
				return drhd->iommu;