Commit 3bd4f911 authored by Jan Niehusmann's avatar Jan Niehusmann Committed by Joerg Roedel

iommu/vt-d: Fix overflow of iommu->domains array

The valid range of 'did' in get_iommu_domain(*iommu, did)
is 0..cap_ndoms(iommu->cap), so don't exceed that
range in free_all_cpu_cached_iovas().

The user-visible impact of the out-of-bounds access is the machine
hanging on suspend-to-ram. It is, in fact, a kernel panic, but due
to already suspended devices, that's often not visible to the user.

Fixes: 22e2f9fa ("iommu/vt-d: Use per-cpu IOVA caching")
Signed-off-by: default avatarJan Niehusmann <jan@gondor.com>
Tested-By: default avatarMarius Vlad <marius.c.vlad@intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 583248e6
......@@ -4607,7 +4607,7 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
if (!iommu)
continue;
for (did = 0; did < 0xffff; did++) {
for (did = 0; did < cap_ndoms(iommu->cap); did++) {
domain = get_iommu_domain(iommu, did);
if (!domain)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment