summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_ttm.c
diff options
context:
space:
mode:
authorGuchun Chen <guchun.chen@amd.com>2021-03-30 22:02:06 +0800
committerAlex Deucher <alexander.deucher@amd.com>2021-04-09 16:49:46 -0400
commitfd6ecc906960c1063c17f23b0b8dad5f6dcea4bc (patch)
tree9e42d98804e2c08d7fe2467a7c9324e8895dd76a /drivers/gpu/drm/radeon/radeon_ttm.c
parent9973de10b5b70b0e5ed9e01e3b392dfc65ab215d (diff)
drm/radeon: avoid potential null pointer access
Leverage the same logic from amdgpu_ttm_tt_unpin_userptr. Signed-off-by: Guchun Chen <guchun.chen@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index c84e128daff8..cdb6d3efd07d 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -415,7 +415,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_device *bdev, struct ttm_tt *
DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
/* double check that we don't free the table twice */
- if (!ttm->sg->sgl)
+ if (!ttm->sg || !ttm->sg->sgl)
return;
/* free the sg table and pages again */