[PATCH] drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence

Christian König ckoenig.leichtzumerken at gmail.com
Thu Nov 9 09:05:28 UTC 2017


Am 09.11.2017 um 08:59 schrieb Emily Deng:
> The array[first] may be null when the fence has already been signaled.
>
> BUG: SWDEV-136239
>
> Signed-off-by: Emily Deng <Emily.Deng at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 354c874..182df08 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1502,8 +1502,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++)




More information about the amd-gfx mailing list