Skip to content

Commit 205323b

Browse files
yanzhao56awilliam
authored andcommitted
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: 8d46c0c ("vfio: introduce vfio_dma_rw to read/write a range of IOVAs") Signed-off-by: Yan Zhao <[email protected]> Reported-by: Kees Cook <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
1 parent ae83d0b commit 205323b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/vfio/vfio_iommu_type1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,10 +2345,10 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,
23452345
vaddr = dma->vaddr + offset;
23462346

23472347
if (write)
2348-
*copied = __copy_to_user((void __user *)vaddr, data,
2348+
*copied = copy_to_user((void __user *)vaddr, data,
23492349
count) ? 0 : count;
23502350
else
2351-
*copied = __copy_from_user(data, (void __user *)vaddr,
2351+
*copied = copy_from_user(data, (void __user *)vaddr,
23522352
count) ? 0 : count;
23532353
if (kthread)
23542354
unuse_mm(mm);

0 commit comments

Comments
 (0)