Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a0cf365

Browse files
Jie1zhangalexdeucher
authored andcommitted
drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
The pointer parent may be NULLed by the function amdgpu_vm_pt_parent. To make the code more robust, check the pointer parent. Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Suggested-by: Christian König <christian.koenig@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 05d9e24 commit a0cf365

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,15 @@ int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
706706
struct amdgpu_vm_bo_base *entry)
707707
{
708708
struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry);
709-
struct amdgpu_bo *bo = parent->bo, *pbo;
709+
struct amdgpu_bo *bo, *pbo;
710710
struct amdgpu_vm *vm = params->vm;
711711
uint64_t pde, pt, flags;
712712
unsigned int level;
713713

714+
if (WARN_ON(!parent))
715+
return -EINVAL;
716+
717+
bo = parent->bo;
714718
for (level = 0, pbo = bo->parent; pbo; ++level)
715719
pbo = pbo->parent;
716720

0 commit comments

Comments
 (0)