]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/amdgpu: Check tbo resource pointer
authorAsad Kamal <asad.kamal@amd.com>
Thu, 25 Apr 2024 18:26:55 +0000 (02:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:18 +0000 (16:18 -0400)
Validate tbo resource pointer, skip if NULL

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 7a6e3d13a454055f3867a8a7b229e5986833b6e9..77f6fd50002acd823346fd5184473f9ddc27df00 100644 (file)
@@ -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;