bo could be NULL in the vm->done list and the
access of it must be avoided.

Signed-off-by: David (Ming Qiang) Wu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index cc2f96ed7004..d0ff226c6dc1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -943,7 +943,7 @@ amdgpu_userq_vm_validate(struct amdgpu_userq_mgr *uq_mgr)
        list_for_each_entry(bo_va, &vm->done, base.vm_status) {
                bo = bo_va->base.bo;
 
-               if (!amdgpu_ttm_tt_is_userptr(bo->tbo.ttm))
+               if (!bo || !amdgpu_ttm_tt_is_userptr(bo->tbo.ttm))
                        continue;
 
                range = xa_load(&xa, key);
-- 
2.43.0

Reply via email to