summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/char/adsprpc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index b898007c63d9..23b48dc6981b 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -479,6 +479,10 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd, uintptr_t va,
if (va >= map->va &&
va + len <= map->va + map->len &&
map->fd == fd) {
+ if (map->refs + 1 == INT_MAX) {
+ spin_unlock(&me->hlock);
+ return -ETOOMANYREFS;
+ }
map->refs++;
match = map;
break;
@@ -491,6 +495,10 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd, uintptr_t va,
if (va >= map->va &&
va + len <= map->va + map->len &&
map->fd == fd) {
+ if (map->refs + 1 == INT_MAX) {
+ spin_unlock(&fl->hlock);
+ return -ETOOMANYREFS;
+ }
map->refs++;
match = map;
break;