Skip to content

Commit 34bfbae

Browse files
Shengjiu WangRussell King
authored andcommitted
ARM: 8475/1: SWP emulation: Restore original *data when failed
__user_swpX_asm maybe failed in first STREX operation, emulate_swpX will try again, but the *data has been changed in first time. which causes the result is wrong. This patch is to fix this issue. When STREX succeed, change the *data. if it fail, *data is not changed. Signed-off-by: Shengjiu Wang <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent fa0708b commit 34bfbae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm/kernel/swp_emulate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
*/
3737
#define __user_swpX_asm(data, addr, res, temp, B) \
3838
__asm__ __volatile__( \
39-
" mov %2, %1\n" \
40-
"0: ldrex"B" %1, [%3]\n" \
41-
"1: strex"B" %0, %2, [%3]\n" \
39+
"0: ldrex"B" %2, [%3]\n" \
40+
"1: strex"B" %0, %1, [%3]\n" \
4241
" cmp %0, #0\n" \
42+
" moveq %1, %2\n" \
4343
" movne %0, %4\n" \
4444
"2:\n" \
4545
" .section .text.fixup,\"ax\"\n" \

0 commit comments

Comments
 (0)