summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.lyra@gmail.com>2017-12-01 03:51:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-03 10:23:21 +0100
commitdb1e8814be999976ea901e9cf7d2e0134e938b31 (patch)
tree5cfe9e947f06c6fb83a225c4c3e7b79150886bb8 /arch/arm/lib
parent3cf31f5b38ed1d78d39e9fb1d460c4684690ec1e (diff)
downloadlinux-stable-db1e8814be999976ea901e9cf7d2e0134e938b31.tar.gz
linux-stable-db1e8814be999976ea901e9cf7d2e0134e938b31.tar.bz2
linux-stable-db1e8814be999976ea901e9cf7d2e0134e938b31.zip
ARM: 8731/1: Fix csum_partial_copy_from_user() stack mismatch
[ Upstream commit 36b0cb84ee858f02c256d26f0cb4229c78e3399e ] An additional 'ip' will be pushed to the stack, for restoring the DACR later, if CONFIG_CPU_SW_DOMAIN_PAN defined. However, the fixup still get the err_ptr by add #8*4 to sp, which results in the fact that the code area pointed by the LR will be overwritten, or the kernel will crash if CONFIG_DEBUG_RODATA is enabled. This patch fixes the stack mismatch. Fixes: a5e090acbf54 ("ARM: software-based priviledged-no-access support") Signed-off-by: Lvqiang Huang <Lvqiang.Huang@spreadtrum.com> Signed-off-by: Chunyan Zhang <zhang.lyra@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 1712f132b80d..b83fdc06286a 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -85,7 +85,11 @@
.pushsection .text.fixup,"ax"
.align 4
9001: mov r4, #-EFAULT
+#ifdef CONFIG_CPU_SW_DOMAIN_PAN
+ ldr r5, [sp, #9*4] @ *err_ptr
+#else
ldr r5, [sp, #8*4] @ *err_ptr
+#endif
str r4, [r5]
ldmia sp, {r1, r2} @ retrieve dst, len
add r2, r2, r1