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

Commit 67b5333b authored by Shubhraprakash Das's avatar Shubhraprakash Das
Browse files

msm: kgsl: The memory entry pending flag should be guarded



Guard the memory entry free pending flag with the process
private lock. This usage of this flag is guarded everywhere
else in the code with the same lock.

Change-Id: Iac27f08876bfe8ff6205edc8233b9c27c6e9a599
Signed-off-by: default avatarShubhraprakash Das <sadas@codeaurora.org>
parent 0023b20a
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -965,9 +965,10 @@ static int kgsl_release(struct inode *inodep, struct file *filep)
	while (1) {
	while (1) {
		spin_lock(&private->mem_lock);
		spin_lock(&private->mem_lock);
		entry = idr_get_next(&private->mem_idr, &next);
		entry = idr_get_next(&private->mem_idr, &next);
		if (entry == NULL) {
			spin_unlock(&private->mem_lock);
			spin_unlock(&private->mem_lock);
		if (entry == NULL)
			break;
			break;
		}
		/*
		/*
		 * If the free pending flag is not set it means that user space
		 * If the free pending flag is not set it means that user space
		 * did not free it's reference to this entry, in that case
		 * did not free it's reference to this entry, in that case
@@ -976,7 +977,10 @@ static int kgsl_release(struct inode *inodep, struct file *filep)
		 */
		 */
		if (entry->dev_priv == dev_priv && !entry->pending_free) {
		if (entry->dev_priv == dev_priv && !entry->pending_free) {
			entry->pending_free = 1;
			entry->pending_free = 1;
			spin_unlock(&private->mem_lock);
			kgsl_mem_entry_put(entry);
			kgsl_mem_entry_put(entry);
		} else {
			spin_unlock(&private->mem_lock);
		}
		}
		next = next + 1;
		next = next + 1;
	}
	}