Need to take the lock when accessing this.
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
        struct amdgpu_bo_list_entry *list;
        unsigned i, idx;
 
+       mutex_lock(&vm->mutex);
        list = drm_malloc_ab(vm->max_pde_used + 2,
                             sizeof(struct amdgpu_bo_list_entry));
-       if (!list)
+       if (!list) {
+               mutex_unlock(&vm->mutex);
                return NULL;
+       }
 
        /* add the vm page table to the list */
        list[0].robj = vm->page_directory;
                list[idx].tv.shared = true;
                list_add(&list[idx++].tv.head, head);
        }
+       mutex_unlock(&vm->mutex);
 
        return list;
 }