From: Christian König <christian.koenig@xxxxxxx> Signed-off-by: Christian König <christian.koenig@xxxxxxx> Reviewed-by: Jammy Zhou <Jammy.Zhou@xxxxxxx> Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 1cc01fb..b25e533 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -936,6 +936,13 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, uint64_t eaddr; int r; + /* validate the parameters */ + if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK || + size == 0 || size & AMDGPU_GPU_PAGE_MASK) { + amdgpu_bo_unreserve(bo_va->bo); + return -EINVAL; + } + /* make sure object fit at this offset */ eaddr = saddr + size; if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) { -- 1.8.3.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel