1
0
Fork 0

drm/ttm: fix dma_fence refcount imbalance on error path

the ttm_bo_add_move_fence takes a reference to the struct dma_fence, but
failed to release it on the error path, leading to a memory leak.
add dma_fence_put before return when error occur.

Signed-off-by: Lin Yi <teroincn@163.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
hifive-unleashed-5.1
Lin Yi 2019-04-10 10:23:34 +08:00 committed by Alex Deucher
parent 453393369d
commit 543c364d8e
1 changed files with 3 additions and 1 deletions

View File

@ -876,8 +876,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
reservation_object_add_shared_fence(bo->resv, fence);
ret = reservation_object_reserve_shared(bo->resv, 1);
if (unlikely(ret))
if (unlikely(ret)) {
dma_fence_put(fence);
return ret;
}
dma_fence_put(bo->moving);
bo->moving = fence;