ASoC: msm: qdsp6v2: Correctly free ASM no wait queue

Remove improper deletion of list head and protect list
deletion with spinlock. Spinlock protects the list
from access in ADSP callback at the same time the
list is being deallocated.

Change-Id: I1b102cd99e7c80e1dfd4e2054b9ba7e0ca26d6a7
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
This commit is contained in:
Ben Romberger 2016-01-22 14:59:01 -08:00 committed by David Keitel
parent 38ebaf2f95
commit c0b53092e3

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
@ -423,6 +423,7 @@ static void q6asm_session_free(struct audio_client *ac)
{
struct list_head *ptr, *next;
struct asm_no_wait_node *node;
unsigned long flags;
pr_debug("%s: sessionid[%d]\n", __func__, ac->session);
rtac_remove_popp_from_adm_devices(ac->session);
@ -431,12 +432,13 @@ static void q6asm_session_free(struct audio_client *ac)
ac->perf_mode = LEGACY_PCM_MODE;
ac->fptr_cache_ops = NULL;
spin_lock_irqsave(&ac->no_wait_que_spinlock, flags);
list_for_each_safe(ptr, next, &ac->no_wait_que) {
node = list_entry(ptr, struct asm_no_wait_node, list);
list_del(&node->list);
kfree(node);
}
list_del(&ac->no_wait_que);
spin_unlock_irqrestore(&ac->no_wait_que_spinlock, flags);
return;
}