diff options
author | Yan Zhao <yan.y.zhao@intel.com> | 2020-04-08 10:12:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-06 09:13:30 +0300 |
commit | f034b331ef320911a865aa2fb4562b290fea3271 (patch) | |
tree | 74ae896222253d054dbbb63562c5621c439e9d24 | |
parent | 751e8b062af0cec10ebda5c70f02f4a7a67eaade (diff) | |
download | linux-f034b331ef320911a865aa2fb4562b290fea3271.tar.xz |
vfio: avoid possible overflow in vfio_iommu_type1_pin_pages
commit 0ea971f8dcd6dee78a9a30ea70227cf305f11ff7 upstream.
add parentheses to avoid possible vaddr overflow.
Fixes: a54eb55045ae ("vfio iommu type1: Add support for mediated devices")
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/vfio/vfio_iommu_type1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index c36275754086..c635ba3167f7 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -598,7 +598,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, 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], do_accounting); if (ret) |