From: Monk Liu Date: Mon, 23 Oct 2017 02:30:57 +0000 (+0800) Subject: drm/ttm:fix memory leak due to individualize X-Git-Tag: v4.15-rc1~90^2~13^2~4 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/bbb4d8d9ee81714b98c25df39a1ed90fa075e90a drm/ttm:fix memory leak due to individualize after individualize we need manually call reservation_object_fini() if all fences on resv signaled during test, otherwise kmemory leak Signed-off-by: Monk Liu Reviewed-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index d79607a1187c..379ec41d2c69 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -457,8 +457,11 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) if (reservation_object_test_signaled_rcu(&bo->ttm_resv, true)) { ttm_bo_del_from_lru(bo); spin_unlock(&glob->lru_lock); - if (bo->resv != &bo->ttm_resv) + if (bo->resv != &bo->ttm_resv) { reservation_object_unlock(&bo->ttm_resv); + reservation_object_fini(&bo->ttm_resv); + } + ttm_bo_cleanup_memtype_use(bo); return; }