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

Commit 79fe9044 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Fix mutex lock deadlock issue



The debugfs method to trigger ssr has already acquired
debugfs srcu lock and is trying to acquire device->lock
in trigger_ssr() function. device->lock was already
acquired by another thread in core_release(). The function
core_release() calling ion_client_destroy() api which is
is trying to acquire the same debugfs srcu lock in function
debugfs_remove_recursive() resulting in deadlock between
trigger_ssr() and core_release() functions. Resolve the 
issue by acquiring core->lock before trigger_ssr() function
to ensure trigger_ssr() and core_release() functions does not
execute at the same time.

CRs-Fixed: 2128555
Change-Id: I35c5c115f0e6281f47a7f108ec75c5870efa743e
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 099e9fc7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5302,6 +5302,8 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
		return -EINVAL;
	}
	hdev = core->device;

	mutex_lock(&core->lock);
	if (core->state == VIDC_CORE_INIT_DONE) {
		/*
		 * In current implementation user-initiated SSR triggers
@@ -5317,7 +5319,11 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
				__func__);
			core->trigger_ssr = false;
		}
	} else {
		dprintk(VIDC_WARN, "%s: video core %pK not initialized\n",
			__func__, core);
	}
	mutex_unlock(&core->lock);

	return rc;
}