[PATCH] drm/radeon: avoid potential null pointer access

Christian König christian.koenig at amd.com
Tue Mar 30 14:22:46 UTC 2021


Am 30.03.21 um 16:04 schrieb Guchun Chen:
> Leverage the same logic from amdgpu_ttm_tt_unpin_userptr.
>
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/radeon/radeon_ttm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 37ac42d6740f..2a61cff325e4 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 */



More information about the amd-gfx mailing list