Commit de34c079 authored by James Hogan's avatar James Hogan Committed by Greg Kroah-Hartman

MIPS: Fix mips_atomic_set() retry condition

commit 2ec420b2 upstream.

The inline asm retry check in the MIPS_ATOMIC_SET operation of the
sysmips system call has been backwards since commit f1e39a4a ("MIPS:
Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
merged in v2.6.32, resulting in the non R10000_LLSC_WAR case retrying
until the operation was inatomic, before returning the new value that
was probably just written multiple times instead of the old value.

Invert the branch condition to fix that particular issue.

Fixes: f1e39a4a ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16148/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 75202d3f
...@@ -141,7 +141,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) ...@@ -141,7 +141,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)
"1: ll %[old], (%[addr]) \n" "1: ll %[old], (%[addr]) \n"
" move %[tmp], %[new] \n" " move %[tmp], %[new] \n"
"2: sc %[tmp], (%[addr]) \n" "2: sc %[tmp], (%[addr]) \n"
" bnez %[tmp], 4f \n" " beqz %[tmp], 4f \n"
"3: \n" "3: \n"
" .insn \n" " .insn \n"
" .subsection 2 \n" " .subsection 2 \n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment