From dac1444e4926f94d8d9ac6b6a098ac101ce4a7be Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 1 Dec 2016 15:28:29 -0800 Subject: DO NOT MERGE - improve audio effect framwework thread safety - Reorganize handle effect creation code to make sure the effect engine is created with both thread and effect chain mutex held. - Reorganize handle disconnect code to make sure the effect engine is released with both thread and effect chain mutex held. - Protect IEffect interface methods in EffectHande with a Mutex. - Only pin effect if the session was acquired first. - Do not use strong pointer to EffectModule in EffectHandles: only the EffectChain has a single strong reference to the EffectModule. Bug: 32707507 CVE-2017-0479 CVE-2017-0480 CVE-2017-0499 Change-Id: Ia1098cba2cd32cc2d1c9dfdff4adc2388dfed80e (cherry picked from commit b378b73dd7480b584340b8028802c9ca2d625123) (cherry picked from commit 22e26d8ee73488c58ba3e7928e5da155151abfd0 with backport by ) --- services/audioflinger/Threads.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'services/audioflinger/Threads.h') diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 8fab1e4..4009c18 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -309,7 +309,8 @@ public: int sessionId, effect_descriptor_t *desc, int *enabled, - status_t *status /*non-NULL*/); + status_t *status /*non-NULL*/, + bool pinned); // return values for hasAudioSession (bit field) enum effect_state { @@ -346,7 +347,9 @@ public: status_t addEffect_l(const sp< EffectModule>& effect); // remove and effect module. Also removes the effect chain is this was the last // effect - void removeEffect_l(const sp< EffectModule>& effect); + void removeEffect_l(const sp< EffectModule>& effect, bool release = false); + // disconnect an effect handle from module and destroy module if last handle + void disconnectEffectHandle(EffectHandle *handle, bool unpinIfLast); // detach all tracks connected to an auxiliary effect virtual void detachAuxEffect_l(int effectId __unused) {} // returns either EFFECT_SESSION if effects on this audio session exist in one -- cgit v1.1