From: Daniel Gomez Date: Thu, 18 Mar 2021 08:32:36 +0000 (+0100) Subject: drm/radeon/ttm: Fix memory leak userptr pages X-Git-Tag: v5.15~1265^2~3^2~185 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=5aeaa43e0ef1006320c077cbc49f4a8229ca3460;p=mirror_ubuntu-kernels.git drm/radeon/ttm: Fix memory leak userptr pages If userptr pages have been pinned but not bounded, they remain uncleared. Reviewed-by: Christian König Signed-off-by: Daniel Gomez Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 476ce9c24b9f..c84e128daff8 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -481,13 +481,14 @@ static void radeon_ttm_backend_unbind(struct ttm_device *bdev, struct ttm_tt *tt struct radeon_ttm_tt *gtt = (void *)ttm; struct radeon_device *rdev = radeon_get_rdev(bdev); + if (gtt->userptr) + radeon_ttm_tt_unpin_userptr(bdev, ttm); + if (!gtt->bound) return; radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages); - if (gtt->userptr) - radeon_ttm_tt_unpin_userptr(bdev, ttm); gtt->bound = false; }