[PATCH] drm/amd/amdgpu: Check tbo resource pointer

Lazar, Lijo lijo.lazar at amd.com
Thu May 2 13:32:28 UTC 2024



On 5/2/2024 7:01 PM, Asad Kamal wrote:
> Validate tbo resource pointer, skip if NULL
> 
> Signed-off-by: Asad Kamal <asad.kamal at amd.com>
> Reviewed-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>

Thanks,
Lijo

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 7a6e3d13a454..77f6fd50002a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5012,7 +5012,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
>  		shadow = vmbo->shadow;
>  
>  		/* No need to recover an evicted BO */
> -		if (shadow->tbo.resource->mem_type != TTM_PL_TT ||
> +		if (!shadow->tbo.resource ||
> +		    shadow->tbo.resource->mem_type != TTM_PL_TT ||
>  		    shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||
>  		    shadow->parent->tbo.resource->mem_type != TTM_PL_VRAM)
>  			continue;


More information about the amd-gfx mailing list