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

Christian König ckoenig.leichtzumerken at gmail.com
Thu Nov 22 11:21:40 UTC 2018


Am 22.11.18 um 03:36 schrieb Sharma, Deepak:
> when returned fence is not valid mostly due to userspace ignored
> previous error causes NULL pointer dereference

NAK, when the fence is NULL then this means it is already signaled and 
no longer in the container.

In other words this is a normal case and the following functions need to 
be able to handle that.

Christian.

>
> Signed-off-by: Deepak Sharma <Deepak.Sharma 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..c85bb313e6df 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1420,6 +1420,8 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data,
>   	fence = amdgpu_cs_get_fence(adev, filp, &info->in.fence);
>   	if (IS_ERR(fence))
>   		return PTR_ERR(fence);
> +	if (!fence)
> +		return -EINVAL;
>   
>   	switch (info->in.what) {
>   	case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ:



More information about the amd-gfx mailing list