[PATCH] drm/amdgpu: add the checking to avoid NULL pointer dereference

zhoucm1 zhoucm1 at amd.com
Thu Nov 22 07:00:40 UTC 2018



On 2018年11月22日 14:56, Sharma, Deepak wrote:
> when returned fence is not valid mostly due to userspace ignored
> previous error causes NULL pointer dereference.
>
> Signed-off-by: Deepak Sharma <Deepak.Sharma at amd.com>
Reviewed-by: Chunming Zhou <david1.zhou at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 024dfbd87f11..14166cd8a12f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1403,6 +1403,8 @@ static struct dma_fence *amdgpu_cs_get_fence(struct amdgpu_device *adev,
>   
>   	fence = amdgpu_ctx_get_fence(ctx, entity, user->seq_no);
>   	amdgpu_ctx_put(ctx);
> +	if(!fence)
> +		return ERR_PTR(-EINVAL);
>   
>   	return fence;
>   }



More information about the amd-gfx mailing list