[PATCH] drm/ttm: fix leaking fences via ttm_buffer_object_transfer

Christian König ckoenig.leichtzumerken at gmail.com
Tue Feb 25 19:09:22 UTC 2020


Am 25.02.20 um 19:56 schrieb Alex Deucher:
> From: Ahzo <Ahzo at tutanota.com>
>
> Set the drm_device to NULL, so that the newly created buffer object
> doesn't appear to use the embedded gem object.
>
> This is necessary, because otherwise no corresponding dma_resv_fini for
> the dma_resv_init is called, resulting in a memory leak.
>
> The dma_resv_fini in ttm_bo_release_list is only called if the embedded
> gem object is not used, which is determined by checking if the
> drm_device is NULL.
>
> Bug: https://gitlab.freedesktop.org/drm/amd/issues/958
> Fixes: 1e053b10ba60 ("drm/ttm: use gem reservation object")
> Signed-off-by: Ahzo <Ahzo at tutanota.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

Good catch I was trying to hunt that one down as well.

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

> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index c8e359ded1df..44c1e7adfb7c 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -514,6 +514,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
>   		fbo->base.base.resv = &fbo->base.base._resv;
>   
>   	dma_resv_init(&fbo->base.base._resv);
> +	fbo->base.base.dev = NULL;
>   	ret = dma_resv_trylock(&fbo->base.base._resv);
>   	WARN_ON(!ret);
>   



More information about the dri-devel mailing list