提交 3bd4f911 编写于 作者: J Jan Niehusmann 提交者: 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: NJan Niehusmann <jan@gondor.com>
Tested-By: NMarius Vlad <marius.c.vlad@intel.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 583248e6
...@@ -4607,7 +4607,7 @@ static void free_all_cpu_cached_iovas(unsigned int cpu) ...@@ -4607,7 +4607,7 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
if (!iommu) if (!iommu)
continue; continue;
for (did = 0; did < 0xffff; did++) { for (did = 0; did < cap_ndoms(iommu->cap); did++) {
domain = get_iommu_domain(iommu, did); domain = get_iommu_domain(iommu, did);
if (!domain) if (!domain)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册