[PATCH 1/6] drm/amdgpu: Fix possible null pointer dereference

Christian König ckoenig.leichtzumerken at gmail.com
Wed Nov 8 12:11:05 UTC 2023


Am 07.11.23 um 17:58 schrieb Felix Kuehling:
> mem = bo->tbo.resource may be NULL in amdgpu_vm_bo_update.
>
> Fixes: 180253782038 ("drm/ttm: stop allocating dummy resources during BO creation")
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>

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

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 7b2a7c9156f0..1442d97ddd0f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1015,8 +1015,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
>   				bo = gem_to_amdgpu_bo(gobj);
>   		}
>   		mem = bo->tbo.resource;
> -		if (mem->mem_type == TTM_PL_TT ||
> -		    mem->mem_type == AMDGPU_PL_PREEMPT)
> +		if (mem && (mem->mem_type == TTM_PL_TT ||
> +			    mem->mem_type == AMDGPU_PL_PREEMPT))
>   			pages_addr = bo->tbo.ttm->dma_address;
>   	}
>   



More information about the amd-gfx mailing list