]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
vfio: avoid possible overflow in vfio_iommu_type1_pin_pages
authorYan Zhao <yan.y.zhao@intel.com>
Wed, 8 Apr 2020 07:12:34 +0000 (03:12 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2020 06:13:30 +0000 (08:13 +0200)
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>
drivers/vfio/vfio_iommu_type1.c

index c362757540866c55e1d96fc11f01c63fef08006b..c635ba3167f7b5020dbbcde63ff8708fe906dfd0 100644 (file)
@@ -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)