summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-08-30 04:03:31 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-08-30 04:03:31 +0000
commitff8cb62ab81628f57f84dd3f31c55409c1b345ac (patch)
tree55f38ef3f1c2fae6ca72059aca8d8be5a5d195ea /sys
parent27fcf632859e8e749b2304e42a294d7d40ae5fa0 (diff)
drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
From Jesse Zhang 3cc03d1dbdcf88d3c05578c286a2e8a07befac93 in linux-6.6.y/6.6.48 511a623fb46a6cf578c61d4f2755783c48807c77 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_pt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_pt.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_pt.c
index 8da974096bc..8c5e7d09485 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_pt.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_pt.c
@@ -766,11 +766,15 @@ int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
struct amdgpu_vm_bo_base *entry)
{
struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry);
- struct amdgpu_bo *bo = parent->bo, *pbo;
+ struct amdgpu_bo *bo, *pbo;
struct amdgpu_vm *vm = params->vm;
uint64_t pde, pt, flags;
unsigned int level;
+ if (WARN_ON(!parent))
+ return -EINVAL;
+
+ bo = parent->bo;
for (level = 0, pbo = bo->parent; pbo; ++level)
pbo = pbo->parent;