Merge "adsprpc: Avoid race condition during map find and free"

This commit is contained in:
qctecmdr 2020-08-16 15:56:09 -07:00 • committed by Gerrit - the friendly Code Review server
commit 1f43952716

View file

@ -1002,9 +1002,11 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags)
}
if (map->flags == ADSP_MMAP_HEAP_ADDR ||
map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
spin_lock(&me->hlock);
map->refs--;
if (!map->refs)
hlist_del_init(&map->hn);
spin_unlock(&me->hlock);
if (map->refs > 0) {
ADSPRPC_WARN(
"multiple references for remote heap size %zu va 0x%lx ref count is %d\n",