Skip to content

Commit

Permalink
drm/amdgpu/ttm: Fix memory leak userptr pages
Browse files Browse the repository at this point in the history
[ Upstream commit 0f6f9dd ]

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 318e8c3 commit d272c70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
Expand Up @@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,
struct amdgpu_ttm_tt *gtt = (void *)ttm;
int r;

if (!gtt->bound)
return;

/* if the pages have userptr pinning then clear that first */
if (gtt->userptr)
amdgpu_ttm_tt_unpin_userptr(bdev, ttm);

if (!gtt->bound)
return;

if (gtt->offset == AMDGPU_BO_INVALID_OFFSET)
return;

Expand Down

0 comments on commit d272c70

Please sign in to comment.