summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTharun Kumar Merugu <mtharu@codeaurora.org>2018-04-03 10:16:18 +0530
committerAlexander Grund <flamefire89@gmail.com>2023-12-23 19:21:48 +0100
commit7af54ebb945341fad6ec21be79a76d1fa3d1cb18 (patch)
treed2149ac0a635db8b76bc5d4de46ea5a1d0ef9692
parent5b3088f3ee800ed22df369de237aaed8caa2ceec (diff)
adsprpc: update mmap list nodes before mmap free
Update mmap list links before every mmap free. Change-Id: Icb612a329e8defd65414842bae20f459c02364b9 Acked-by: Thyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com> Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
-rw-r--r--drivers/char/adsprpc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index 69bfaa0bc6f4..244ae28757d3 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -2562,8 +2562,8 @@ static void fastrpc_session_free(struct fastrpc_channel_ctx *chan,
static int fastrpc_file_free(struct fastrpc_file *fl)
{
- struct hlist_node *n;
- struct fastrpc_mmap *map = NULL;
+ struct hlist_node *n = NULL;
+ struct fastrpc_mmap *map = NULL, *lmap = NULL;
int cid;
if (!fl)
@@ -2587,9 +2587,16 @@ static int fastrpc_file_free(struct fastrpc_file *fl)
fastrpc_buf_free(fl->init_mem, 0);
fastrpc_context_list_dtor(fl);
fastrpc_cached_buf_list_free(fl);
- hlist_for_each_entry_safe(map, n, &fl->maps, hn) {
- fastrpc_mmap_free(map);
- }
+ do {
+ lmap = NULL;
+ hlist_for_each_entry_safe(map, n, &fl->maps, hn) {
+ hlist_del_init(&map->hn);
+ lmap = map;
+ break;
+ }
+ fastrpc_mmap_free(lmap);
+ } while (lmap);
+
if (fl->ssrcount == fl->apps->channel[cid].ssrcount)
kref_put_mutex(&fl->apps->channel[cid].kref,
fastrpc_channel_close, &fl->apps->smd_mutex);