Commit f034b331 authored by Yan Zhao's avatar Yan Zhao Committed by Greg Kroah-Hartman

vfio: avoid possible overflow in vfio_iommu_type1_pin_pages

commit 0ea971f8 upstream.

add parentheses to avoid possible vaddr overflow.

Fixes: a54eb550 ("vfio iommu type1: Add support for mediated devices")
Signed-off-by: default avatarYan Zhao <yan.y.zhao@intel.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 751e8b06
...@@ -598,7 +598,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, ...@@ -598,7 +598,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data,
continue; continue;
} }
remote_vaddr = dma->vaddr + iova - dma->iova; remote_vaddr = dma->vaddr + (iova - dma->iova);
ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i], ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i],
do_accounting); do_accounting);
if (ret) if (ret)
......
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