Commit 6717f7c3 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Lock the drm_mm as we search

Hold onto the vm->mutex (to lock the drm_mm) to ensure that the rbtree
is stable as we search it for our scratch node.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128183458.3860022-1-chris@chris-wilson.co.uk
parent 0543fbf4
......@@ -1465,9 +1465,12 @@ static int igt_ctx_readonly(void *arg)
static int check_scratch(struct i915_address_space *vm, u64 offset)
{
struct drm_mm_node *node =
__drm_mm_interval_first(&vm->mm,
offset, offset + sizeof(u32) - 1);
struct drm_mm_node *node;
mutex_lock(&vm->mutex);
node = __drm_mm_interval_first(&vm->mm,
offset, offset + sizeof(u32) - 1);
mutex_unlock(&vm->mutex);
if (!node || node->start > offset)
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment