[PATCH 01/11] drm/amdgpu: Fix possible null pointer dereference

Christian König christian.koenig at amd.com
Wed Oct 18 06:50:47 UTC 2023


Am 17.10.23 um 23:13 schrieb Felix Kuehling:
> abo->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 | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 46d27c8ffff7..d72daf15662f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1007,7 +1007,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
>   			struct drm_gem_object *gobj = dma_buf->priv;
>   			struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
>   
> -			if (abo->tbo.resource->mem_type == TTM_PL_VRAM)
> +			if (abo->tbo.resource &&
> +			    abo->tbo.resource->mem_type == TTM_PL_VRAM)
>   				bo = gem_to_amdgpu_bo(gobj);
>   		}
>   		mem = bo->tbo.resource;



More information about the dri-devel mailing list