提交 c43ef10a 编写于 作者: Y Yong Wu 提交者: Zheng Zengkai

iommu: Switch gather->end to the inclusive end

mainline inclusion
from mainline-5.12-rc1
commit 862c3715
category: feature
bugzilla: 51855
CVE: NA

---------------------------------------------

Currently gather->end is "unsigned long" which may be overflow in
arch32 in the corner case: 0xfff00000 + 0x100000(iova + size).
Although it doesn't affect the size(end - start), it affects the checking
"gather->end < end"

This patch changes this "end" to the real end address
(end = start + size - 1). Correspondingly, update the length to
"end - start + 1".

Fixes: a7d20dc1 ("iommu: Introduce struct iommu_iotlb_gather for batching TLB flushes")
Signed-off-by: NYong Wu <yong.wu@mediatek.com>
Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
Acked-by: NWill Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210107122909.16317-5-yong.wu@mediatek.comSigned-off-by: NWill Deacon <will@kernel.org>
Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 169c758c
...@@ -270,7 +270,7 @@ static void gart_iommu_sync_map(struct iommu_domain *domain, unsigned long iova, ...@@ -270,7 +270,7 @@ static void gart_iommu_sync_map(struct iommu_domain *domain, unsigned long iova,
static void gart_iommu_sync(struct iommu_domain *domain, static void gart_iommu_sync(struct iommu_domain *domain,
struct iommu_iotlb_gather *gather) struct iommu_iotlb_gather *gather)
{ {
size_t length = gather->end - gather->start; size_t length = gather->end - gather->start + 1;
gart_iommu_sync_map(domain, gather->start, length); gart_iommu_sync_map(domain, gather->start, length);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册