Skip to content

Commit

Permalink
drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence
Browse files Browse the repository at this point in the history
The array[first] may be null when the fence has already been signaled.

BUG: SWDEV-136239

Signed-off-by: Emily Deng <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
EmilyDeng666 authored and alexdeucher committed Nov 9, 2017
1 parent ab6613b commit cdadab8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,11 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
memset(wait, 0, sizeof(*wait));
wait->out.status = (r > 0);
wait->out.first_signaled = first;
/* set return value 0 to indicate success */
r = array[first]->error;

if (array[first])
r = array[first]->error;
else
r = 0;

err_free_fence_array:
for (i = 0; i < fence_count; i++)
Expand Down

0 comments on commit cdadab8

Please sign in to comment.