summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYan Zhao <yan.y.zhao@intel.com>2020-04-08 09:11:21 +0200
committerAlex Williamson <alex.williamson@redhat.com>2020-04-20 20:38:22 +0200
commit205323b8ceac57b0ac9d7dbc4d6fcdb18aa802ec (patch)
tree408a73957b316c64204997b53689f1c56d5b37f0 /drivers
parentLinux 5.7-rc2 (diff)
downloadlinux-205323b8ceac57b0ac9d7dbc4d6fcdb18aa802ec.tar.xz
linux-205323b8ceac57b0ac9d7dbc4d6fcdb18aa802ec.zip
vfio: checking of validity of user vaddr in vfio_dma_rw
instead of calling __copy_to/from_user(), use copy_to_from_user() to ensure vaddr range is a valid user address range before accessing them. Fixes: 8d46c0cca5f4 ("vfio: introduce vfio_dma_rw to read/write a range of IOVAs") Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> Reported-by: Kees Cook <keescook@chromium.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/vfio/vfio_iommu_type1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 85b32c325282..aa501e826e70 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -2345,10 +2345,10 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,
vaddr = dma->vaddr + offset;
if (write)
- *copied = __copy_to_user((void __user *)vaddr, data,
+ *copied = copy_to_user((void __user *)vaddr, data,
count) ? 0 : count;
else
- *copied = __copy_from_user(data, (void __user *)vaddr,
+ *copied = copy_from_user(data, (void __user *)vaddr,
count) ? 0 : count;
if (kthread)
unuse_mm(mm);