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

Commit a4c1c9c3 authored by Rohit Kumar's avatar Rohit Kumar Committed by Banajit Goswami
Browse files

drivers: soc: Add mutex lock in audio_notifier_late_init



Audio_notifier_late_init registers clients dependent on PDR to
correct service if registration to PDR on init fails.
There is a possible race condition when audio_notifier_late_init
and audio_notifier_register is called at same time. This may
cause manipulation of the same lists and critical data at the
same time. Add mutex lock to protect critical data.

CRs-Fixed: 2016927
Change-Id: Iec5190a93b390d46f47fd67fd79b1b83d7fe4b29
Signed-off-by: default avatarRohit Kumar <rohitkr@codeaurora.org>
parent 70344a3a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -626,9 +626,11 @@ static int __init audio_notifier_late_init(void)
	 * If pdr registration failed, register clients on next service
	 * Do in late init to ensure that SSR subsystem is initialized
	 */
	mutex_lock(&notifier_mutex);
	if (!audio_notifer_is_service_enabled(AUDIO_NOTIFIER_PDR_SERVICE))
		audio_notifer_reg_all_clients();

	mutex_unlock(&notifier_mutex);
	return 0;
}
late_initcall(audio_notifier_late_init);