From 84b02e0fd5e098c20eb4056253c8c91a8fa0a668 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Mon, 17 Apr 2023 19:43:40 +0300 Subject: [PATCH] smart_amp_test: fix unbind implementation Code in unbind is looking at wrong field for queue-id. This works some of the time, but in some cases leads to access to freed heap data and later to heap corruption. Link: https://github.com/thesofproject/sof/issues/7191 Signed-off-by: Kai Vehmanen --- src/samples/audio/smart_amp_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/samples/audio/smart_amp_test.c b/src/samples/audio/smart_amp_test.c index e643c6600fbf..10eb2e6f31e2 100644 --- a/src/samples/audio/smart_amp_test.c +++ b/src/samples/audio/smart_amp_test.c @@ -298,7 +298,7 @@ static int smart_amp_unbind(struct comp_dev *dev, void *data) comp_dbg(dev, "smart_amp_unbind()"); - if (bu->extension.r.dst_instance_id == SOF_SMART_AMP_FEEDBACK_QUEUE_ID) { + if (bu->extension.r.dst_queue == SOF_SMART_AMP_FEEDBACK_QUEUE_ID) { k_mutex_lock(&sad->lock, K_FOREVER); sad->feedback_buf = NULL; k_mutex_unlock(&sad->lock);