drm/amdgpu: validate amdgpu_vm_bo_map parameters
Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
271c812566
commit
0be52de91c
1 changed files with 7 additions and 0 deletions
|
@ -936,6 +936,13 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
|
||||||
uint64_t eaddr;
|
uint64_t eaddr;
|
||||||
int r;
|
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 */
|
/* make sure object fit at this offset */
|
||||||
eaddr = saddr + size;
|
eaddr = saddr + size;
|
||||||
if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) {
|
if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue