[PATCH 2/2] drm/amd/amdgpu: fix locking in bo creation error path
Christian König
deathsimple at vodafone.de
Wed Jan 11 11:57:08 UTC 2017
Am 11.01.2017 um 08:31 schrieb Nicolai Hähnle:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Unlock the resv lock only if we were the ones to lock it in the first
> place.
>
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com>.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 357eed9..d9d6793 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -401,21 +401,22 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
> }
> if (!resv)
> ww_mutex_unlock(&bo->tbo.resv->lock);
> *bo_ptr = bo;
>
> trace_amdgpu_bo_create(bo);
>
> return 0;
>
> fail_unreserve:
> - ww_mutex_unlock(&bo->tbo.resv->lock);
> + if (!resv)
> + ww_mutex_unlock(&bo->tbo.resv->lock);
> amdgpu_bo_unref(&bo);
> return r;
> }
>
> static int amdgpu_bo_create_shadow(struct amdgpu_device *adev,
> unsigned long size, int byte_align,
> struct amdgpu_bo *bo)
> {
> struct ttm_placement placement = {0};
> struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1];
More information about the amd-gfx
mailing list