Skip to content

Commit 9c3db58

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
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: d1a372a ("drm/amdgpu: Set MTYPE in PTE based on BO flags") Signed-off-by: Christian König <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 47ea207 commit 9c3db58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,8 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev,
11851185
struct amdgpu_bo_va_mapping *mapping,
11861186
uint64_t *flags)
11871187
{
1188+
struct amdgpu_bo *bo = mapping->bo_va->base.bo;
1189+
11881190
*flags &= ~AMDGPU_PTE_EXECUTABLE;
11891191
*flags |= mapping->flags & AMDGPU_PTE_EXECUTABLE;
11901192

@@ -1196,7 +1198,7 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev,
11961198
*flags &= ~AMDGPU_PTE_VALID;
11971199
}
11981200

1199-
if (mapping->bo_va->base.bo)
1201+
if (bo && bo->tbo.resource)
12001202
gmc_v9_0_get_coherence_flags(adev, mapping->bo_va->base.bo,
12011203
mapping, flags);
12021204
}

0 commit comments

Comments
 (0)