From: Christian König Date: Wed, 7 Dec 2022 07:47:30 +0000 (+0100) Subject: drm/amdgpu: fixx NULL pointer deref in gmc_v9_0_get_vm_pte X-Git-Tag: v6.6.17~5375^2~30^2~108 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c3db58bf8f7d0007049f686ce8c419eed4325d1;p=platform%2Fkernel%2Flinux-rpi.git drm/amdgpu: fixx NULL pointer deref in gmc_v9_0_get_vm_pte We not only need to make sure that we have a BO, but also that the BO has some backing store. Fixes: d1a372af1c3d ("drm/amdgpu: Set MTYPE in PTE based on BO flags") Signed-off-by: Christian König Reviewed-by: Felix Kuehling Reviewed-by: Alex Deucher Reviewed-by: Luben Tuikov Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 50386eb..08d6cf7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1185,6 +1185,8 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, struct amdgpu_bo_va_mapping *mapping, uint64_t *flags) { + struct amdgpu_bo *bo = mapping->bo_va->base.bo; + *flags &= ~AMDGPU_PTE_EXECUTABLE; *flags |= mapping->flags & AMDGPU_PTE_EXECUTABLE; @@ -1196,7 +1198,7 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, *flags &= ~AMDGPU_PTE_VALID; } - if (mapping->bo_va->base.bo) + if (bo && bo->tbo.resource) gmc_v9_0_get_coherence_flags(adev, mapping->bo_va->base.bo, mapping, flags); }