Skip to content

Commit

Permalink
drm/radeon/ttm: Fix memory leak userptr pages
Browse files Browse the repository at this point in the history
[ Upstream commit 5aeaa43 ]

If userptr pages have been pinned but not bounded,
they remain uncleared.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Gomez <daniel@qtec.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Daniel Gomez authored and gregkh committed May 12, 2021
1 parent d272c70 commit fc3393e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/radeon/radeon_ttm.c
Expand Up @@ -485,13 +485,14 @@ static void radeon_ttm_backend_unbind(struct ttm_bo_device *bdev, struct ttm_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;
}

Expand Down

0 comments on commit fc3393e

Please sign in to comment.