Skip to content

Commit de34c07

Browse files
James Hogangregkh
authored andcommitted
MIPS: Fix mips_atomic_set() retry condition
commit 2ec420b26f7b6ff332393f0bb5a7d245f7ad87f0 upstream. The inline asm retry check in the MIPS_ATOMIC_SET operation of the sysmips system call has been backwards since commit f1e39a4 ("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: f1e39a4 ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/16148/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 75202d3 commit de34c07

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/mips/kernel/syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)
141141
"1: ll %[old], (%[addr]) \n"
142142
" move %[tmp], %[new] \n"
143143
"2: sc %[tmp], (%[addr]) \n"
144-
" bnez %[tmp], 4f \n"
144+
" beqz %[tmp], 4f \n"
145145
"3: \n"
146146
" .insn \n"
147147
" .subsection 2 \n"

0 commit comments

Comments
 (0)