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

Commit d46452b2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Release process memory outside of mutex to avoid a deadlock"

parents c1014399 c6173fbb
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -960,24 +960,34 @@ static void kgsl_process_private_close(struct kgsl_device_private *dev_priv,
{
	mutex_lock(&kgsl_driver.process_mutex);

	if (--private->fd_count > 0) {
		mutex_unlock(&kgsl_driver.process_mutex);
		kgsl_process_private_put(private);
		return;
	}

	/*
	 * If this is the last file on the process take down the debug
	 * directories and garbage collect any outstanding resources
	 */

	if (--private->fd_count == 0) {
	kgsl_process_uninit_sysfs(private);
	debugfs_remove_recursive(private->debug_root);

		process_release_memory(dev_priv, private);
	process_release_sync_sources(private);

	/* Remove the process struct from the master list */
	list_del(&private->list);
	}

	kgsl_process_private_put(private);
	/*
	 * Unlock the mutex before releasing the memory - this prevents a
	 * deadlock with the IOMMU mutex if a page fault occurs
	 */
	mutex_unlock(&kgsl_driver.process_mutex);

	process_release_memory(dev_priv, private);

	kgsl_process_private_put(private);
}