diff options
author | John David Anglin <dave.anglin@bell.net> | 2017-09-30 17:24:23 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-01-01 20:51:56 +0000 |
commit | 83527ee6a78644da89c21b56fd0f9b0caea48554 (patch) | |
tree | 3cf0b2cdac304154d0685733c9fbbe4bb5bd4793 /arch/parisc | |
parent | 30fe79f8171f5165aba9e043868fc9cf53c36b2e (diff) | |
download | linux-stable-83527ee6a78644da89c21b56fd0f9b0caea48554.tar.gz linux-stable-83527ee6a78644da89c21b56fd0f9b0caea48554.tar.bz2 linux-stable-83527ee6a78644da89c21b56fd0f9b0caea48554.zip |
parisc: Fix double-word compare and exchange in LWS code on 32-bit kernels
commit 374b3bf8e8b519f61eb9775888074c6e46b3bf0c upstream.
As discussed on the debian-hppa list, double-wordcompare and exchange
operations fail on 32-bit kernels. Looking at the code, I realized that
the ",ma" completer does the wrong thing in the "ldw,ma 4(%r26), %r29"
instruction. This increments %r26 and causes the following store to
write to the wrong location.
Note by Helge Deller:
The patch applies cleanly to stable kernel series if this upstream
commit is merged in advance:
f4125cfdb300 ("parisc: Avoid trashing sr2 and sr3 in LWS code").
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Tested-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Fixes: 89206491201c ("parisc: Implement new LWS CAS supporting 64 bit operations.")
Signed-off-by: Helge Deller <deller@gmx.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/kernel/syscall.S | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index f716e9e65a49..df6ff75c03ce 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S @@ -742,7 +742,7 @@ lws_compare_and_swap_2: 10: ldd 0(%sr3,%r25), %r25 11: ldd 0(%sr3,%r24), %r24 #else - /* Load new value into r22/r23 - high/low */ + /* Load old value into r22/r23 - high/low */ 10: ldw 0(%sr3,%r25), %r22 11: ldw 4(%sr3,%r25), %r23 /* Load new value into fr4 for atomic store later */ @@ -834,11 +834,11 @@ cas2_action: copy %r0, %r28 #else /* Compare first word */ -19: ldw,ma 0(%sr3,%r26), %r29 +19: ldw 0(%sr3,%r26), %r29 sub,= %r29, %r22, %r0 b,n cas2_end /* Compare second word */ -20: ldw,ma 4(%sr3,%r26), %r29 +20: ldw 4(%sr3,%r26), %r29 sub,= %r29, %r23, %r0 b,n cas2_end /* Perform the store */ |