Commit cdadab89 authored by Emily Deng's avatar Emily Deng Committed by Alex Deucher

drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence

The array[first] may be null when the fence has already been signaled.

BUG: SWDEV-136239
Signed-off-by: default avatarEmily Deng <Emily.Deng@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ab6613b7
...@@ -1497,8 +1497,11 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, ...@@ -1497,8 +1497,11 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
memset(wait, 0, sizeof(*wait)); memset(wait, 0, sizeof(*wait));
wait->out.status = (r > 0); wait->out.status = (r > 0);
wait->out.first_signaled = first; wait->out.first_signaled = first;
/* set return value 0 to indicate success */
if (array[first])
r = array[first]->error; r = array[first]->error;
else
r = 0;
err_free_fence_array: err_free_fence_array:
for (i = 0; i < fence_count; i++) for (i = 0; i < fence_count; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment