[PATCH 07/22] drm/amdgpu: fix fence_emit NULL pointer ref risk

Christian König ckoenig.leichtzumerken at gmail.com
Mon Feb 26 09:58:23 UTC 2018


Am 26.02.2018 um 06:18 schrieb Monk Liu:
> Change-Id: Ic39de73338d515d4e33a828f445d8a3c3ba544bb
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 008e198..401d710 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -163,7 +163,8 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f)
>   
>   	rcu_assign_pointer(*ptr, dma_fence_get(&fence->base));
>   
> -	*f = &fence->base;
> +	if (f)
> +		*f = &fence->base;

NAK, returning the fence pointer isn't optional here.

Christian.

>   
>   	return 0;
>   }



More information about the amd-gfx mailing list