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

Commit 1c46b098 authored by zhouchenchang's avatar zhouchenchang Committed by Shunkai Yao
Browse files

Audio: fix ~refbase() crash caused by race condition



[cause]:When ~SuspendedEffectDesc() is called, mSuspendedEffects race condition cause strong refcount of SuspendedEffectDesc obj is 1, which causing a fatal error.
[example]:
    1. thread1:
	AudioFlinger::setEffectSuspended
		|-> ThreadBase::setEffectSuspended_l
			|-> EffectChain::setEffectSuspended_l
				|-> ~SuspendedEffectDesc
					|-> ~RefBase
    2. thread2:
	EffectChain::EffectCallback::onEffectDisable
		|-> EffectCallback::checkSuspendOnEffectEnabled
			|-> EffectChain::checkSuspendOnEffectEnabled_l
				|-> incStrong
[solution]:add mutex for mSuspendedEffects

Flag: EXEMPT bugfix
Bug: 408017789
Test: atest CtsMediaAudioTestCases
Change-Id: I344747a4f2cd5ea7620ce74f11625926a23f178a
Signed-off-by: default avatarzhouchenchang <zhouchenchang@xiaomi.com>
parent 0f1821a3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment