From: jsg Date: Fri, 30 Aug 2024 04:03:30 +0000 (+0000) Subject: drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=523bdaadbe21dfc94e3f4519ce7a2964ebb2e10f;p=openbsd 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 --- 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;