Skip to content

Commit c1652b3

Browse files
Srikanth A Rhudsoncm
authored andcommitted
msm:ADSPRPC :Fix to avoid Use after free in fastrpc_internal_munmap
Added a check to validate map before freeing it to avoid Use after free scenario. Bug id: A-179040600 CVE-Fixed: CVE-2021-1927 Crs-fixed: 2827356 Mot-CRs-fixed: (CR) Change-Id: Ic723a4fe964a4909119663500018f2a07976105b Signed-off-by: Vamsi krishna Gattupalli <vgattupa@codeaurora.org> Signed-off-by: Srkanth A R <arsrikan@motorola.com> Reviewed-on: https://gerrit.mot.com/1931280 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com> Reviewed-by: Ravikumar Vembu <raviv@motorola.com> Submit-Approved: Jira Key
1 parent 247ea81 commit c1652b3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

drivers/char/adsprpc.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,13 +2670,15 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl,
26702670
mutex_unlock(&fl->map_mutex);
26712671
if (err)
26722672
goto bail;
2673-
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
2674-
map->phys, map->size, map->flags));
2675-
if (err)
2676-
goto bail;
2677-
mutex_lock(&fl->map_mutex);
2678-
fastrpc_mmap_free(map, 0);
2679-
mutex_unlock(&fl->map_mutex);
2673+
if (map) {
2674+
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
2675+
map->phys, map->size, map->flags));
2676+
if (err)
2677+
goto bail;
2678+
mutex_lock(&fl->map_mutex);
2679+
fastrpc_mmap_free(map, 0);
2680+
mutex_unlock(&fl->map_mutex);
2681+
}
26802682
bail:
26812683
if (err && map) {
26822684
mutex_lock(&fl->map_mutex);

0 commit comments

Comments
 (0)