Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4930cb1c authored by Lynus Vaz's avatar Lynus Vaz
Browse files

msm: kgsl: Use a lock when updating the sparse bindings



Use the appropriate lock when adding sparse bindings, to protect the
list of sparse bindings from concurrent updates by multiple threads.

Change-Id: Ice9750c96fca42f4049ed352533f4722b5166221
Signed-off-by: default avatarLynus Vaz <lvaz@codeaurora.org>
parent e8c82574
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3461,6 +3461,7 @@ long kgsl_ioctl_sparse_virt_free(struct kgsl_device_private *dev_priv,
	return 0;
}

/* entry->bind_lock must be held by the caller */
static int _sparse_add_to_bind_tree(struct kgsl_mem_entry *entry,
		uint64_t v_offset,
		struct kgsl_memdesc *memdesc,
@@ -3719,8 +3720,11 @@ static int _sparse_bind(struct kgsl_process_private *process,
		return ret;
	}

	spin_lock(&virt_entry->bind_lock);
	ret = _sparse_add_to_bind_tree(virt_entry, v_offset, memdesc,
			p_offset, size, flags);
	spin_unlock(&virt_entry->bind_lock);

	if (ret == 0)
		memdesc->cur_bindings += size / PAGE_SIZE;