Skip to content

Commit

Permalink
drm/amdgpu: return error if both BOs and bo_list handle is given
Browse files Browse the repository at this point in the history
Return -EINVAL when both the BOs as well as a list handle is provided in
the IOCTL.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming  Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König authored and Alex Deucher committed Jul 31, 2018
1 parent 275105c commit 0cb7c1f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,17 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
INIT_LIST_HEAD(&p->validated);

/* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */
if (p->bo_list) {
mutex_lock(&p->bo_list->lock);
if (cs->in.bo_list_handle) {
if (p->bo_list)
return -EINVAL;

} else if (cs->in.bo_list_handle) {
r = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle,
&p->bo_list);
if (r)
return r;

} else if (p->bo_list) {
mutex_lock(&p->bo_list->lock);
}

if (p->bo_list) {
Expand Down

0 comments on commit 0cb7c1f

Please sign in to comment.