From: Guchun Chen Date: Tue, 30 Mar 2021 14:02:06 +0000 (+0800) Subject: drm/radeon: avoid potential null pointer access X-Git-Tag: v5.13-rc1~123^2~3^2~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd6ecc906960c1063c17f23b0b8dad5f6dcea4bc;p=thirdparty%2Fkernel%2Flinux.git drm/radeon: avoid potential null pointer access Leverage the same logic from amdgpu_ttm_tt_unpin_userptr. Signed-off-by: Guchun Chen Reviewed-by: Christian König Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index c84e128daff87..cdb6d3efd07db 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 */