drm/amd/amdgpu: fix over-bound accessing in amdgpu_cs_wait_any_fence
authorRoger He <Hongbo.He@amd.com>
Fri, 17 Nov 2017 04:45:18 +0000 (12:45 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Nov 2017 20:00:52 +0000 (15:00 -0500)
Fixes an oops in amdgpu_cs_wait_any_fence.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index 146e05f..bdef497 100644 (file)
@@ -1498,7 +1498,7 @@ out:
        wait->out.status = (r > 0);
        wait->out.first_signaled = first;
 
-       if (array[first])
+       if (first < fence_count && array[first])
                r = array[first]->error;
        else
                r = 0;