diff options
author | Xianzhong <xianzhong.li@nxp.com> | 2019-10-29 01:55:53 +0800 |
---|---|---|
committer | Xianzhong <xianzhong.li@nxp.com> | 2019-12-06 01:30:42 +0800 |
commit | 51ee01ba92534e2c57f0844a40c3223b041042f2 (patch) | |
tree | 7ea1a094c1c761e5d65b73a8529fd80a8d99079f /drivers/mxc/gpu-viv | |
parent | 1f3a54242090ea98274ce18e90c79d65edf8ad71 (diff) |
MGS-5284 [#imx-1786] fix GPU panic with vm_mmap failure
When vm_mmap fail, code jump to OnError with error status and userLogical variable != 0.
Then _CMAFSLUnmapUser is called with a invalid virtual address (MdlMap->vmaAddr) and cause panic.
Check userLogical to avoid GPU kernel panic for error handling.
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 7ba5a24fc46a7f50d8406d9ae9ca6ce75c2a71ba)
Diffstat (limited to 'drivers/mxc/gpu-viv')
-rw-r--r-- | drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c index dfb432527f38..45fa00b91a89 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c @@ -441,7 +441,7 @@ _CMAFSLMapUser( up_write(¤t->mm->mmap_sem); OnError: - if (gcmIS_ERROR(status) && userLogical) + if (gcmIS_ERROR(status) && userLogical && !IS_ERR(userLogical)) { _CMAFSLUnmapUser(Allocator, Mdl, userLogical, Mdl->numPages * PAGE_SIZE); } |