diff options
| author | Tharun Kumar Merugu <mtharu@codeaurora.org> | 2018-12-27 19:23:57 +0530 |
|---|---|---|
| committer | Alexander Grund <flamefire89@gmail.com> | 2023-12-23 19:22:22 +0100 |
| commit | cbe60550000c67276ae9f064d3df45edf085b1bd (patch) | |
| tree | f68413bd7aa76e77f8d6562d524fb51beaa66603 | |
| parent | 1e0f188773f9c191feaab224a4d4b62c46180b69 (diff) | |
msm: ADSPRPC: Protect global remote heap maps
Protect global remote heap map by using spin locks, so that no
concurrent threads can corrupt the map list
Change-Id: I688b532988bebc4ac6c4ed80b5bd857968671450
Acked-by: Himateja Reddy <hmreddy@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
| -rw-r--r-- | drivers/char/adsprpc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index efb40c9ab71a..105678e7a499 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -468,7 +468,9 @@ static void fastrpc_mmap_add(struct fastrpc_mmap *map) map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) { struct fastrpc_apps *me = &gfa; + spin_lock(&me->hlock); hlist_add_head(&map->hn, &me->maps); + spin_unlock(&me->hlock); } else { struct fastrpc_file *fl = map->fl; @@ -487,6 +489,7 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd, uintptr_t va, return -EOVERFLOW; if (mflags == ADSP_MMAP_HEAP_ADDR || mflags == ADSP_MMAP_REMOTE_HEAP_ADDR) { + spin_lock(&me->hlock); hlist_for_each_entry_safe(map, n, &me->maps, hn) { if (va >= map->va && va + len <= map->va + map->len && @@ -500,6 +503,7 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd, uintptr_t va, break; } } + spin_unlock(&me->hlock); } else { hlist_for_each_entry_safe(map, n, &fl->maps, hn) { if (va >= map->va && @@ -547,6 +551,7 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va, struct hlist_node *n; struct fastrpc_apps *me = &gfa; + spin_lock(&me->hlock); hlist_for_each_entry_safe(map, n, &me->maps, hn) { if (map->refs == 1 && map->raddr == va && map->raddr + map->len == va + len && @@ -557,6 +562,7 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va, break; } } + spin_unlock(&me->hlock); if (match) { *ppmap = match; return 0; |
