From eb3c337a3d6c74ec857dfc8be7eeafe634614bcd Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 25 Sep 2013 12:25:29 -0700 Subject: fix deadlock in audioflinger::createEffect() commit 5baf2af5 introduced a regression by calling getOutputForEffect() with AudioFLinger main mutex locked. The locking order must always be AudioPolicyService mutex then AudioFlinger then ThreadBase mutex. Bug: 10916796. Change-Id: Ide34a2d84dbb06dbb35abd0640d91b01b0ac4d40 --- services/audioflinger/Effects.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'services/audioflinger/Effects.h') diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h index c35cff0..b717857 100644 --- a/services/audioflinger/Effects.h +++ b/services/audioflinger/Effects.h @@ -25,6 +25,10 @@ // state changes or resource modifications. Always respect the following order // if multiple mutexes must be acquired to avoid cross deadlock: // AudioFlinger -> ThreadBase -> EffectChain -> EffectModule +// In addition, methods that lock the AudioPolicyService mutex (getOutputForEffect(), +// startOutput()...) should never be called with AudioFlinger or Threadbase mutex locked +// to avoid cross deadlock with other clients calling AudioPolicyService methods that in turn +// call AudioFlinger thus locking the same mutexes in the reverse order. // The EffectModule class is a wrapper object controlling the effect engine implementation // in the effect library. It prevents concurrent calls to process() and command() functions -- cgit v1.1