summaryrefslogtreecommitdiff
path: root/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator
diff options
context:
space:
mode:
authorXianzhong <xianzhong.li@nxp.com>2019-10-29 01:55:53 +0800
committerXianzhong <xianzhong.li@nxp.com>2019-12-06 01:30:42 +0800
commit51ee01ba92534e2c57f0844a40c3223b041042f2 (patch)
tree7ea1a094c1c761e5d65b73a8529fd80a8d99079f /drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator
parent1f3a54242090ea98274ce18e90c79d65edf8ad71 (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/hal/os/linux/kernel/allocator')
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c2
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(&current->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);
}