From 4d8ab90a88aa630612a4d0eda8734f5ac3bf4197 Mon Sep 17 00:00:00 2001 From: rioskao Date: Fri, 16 Oct 2020 12:58:19 +0800 Subject: sthal: prevent double free the inactive model note: Sometimes the specified sequence control by top layer that would cause the double free inside ext dsp. Test: manuall simulate the sequence and test. Bug: 171013585 Change-Id: I69b186e0b1205a1090a8965dfcf9ff4d903fed41 --- sound_trigger_hw_iaxxx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c index 014c96a..495be0e 100644 --- a/sound_trigger_hw_iaxxx.c +++ b/sound_trigger_hw_iaxxx.c @@ -2628,6 +2628,10 @@ static int stop_recognition(struct knowles_sound_trigger_device *stdev, model->is_active = false; goto exit; } + if (model->is_active == false) { + ALOGW("%s: the model was disabled already", __func__); + goto exit; + } if (stdev->adnc_strm_handle[handle] != 0) { ALOGD("%s: stop tunnling for index:%d", __func__, handle); -- cgit v1.2.3