diff options
author | James Hogan <james.hogan@imgtec.com> | 2017-05-31 16:19:47 +0100 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-09-10 10:59:18 -0400 |
commit | 85995071cafdda640346962e5817cac343d43cd4 (patch) | |
tree | de8c75d9c1c71a9a0789a46396f62f7ac498f21b /arch/mips | |
parent | 9a8b134ea7fe5c6eb55197f617c1d8ff5fe6b8e8 (diff) |
MIPS: Fix mips_atomic_set() retry condition
[ Upstream commit 2ec420b26f7b6ff332393f0bb5a7d245f7ad87f0 ]
The inline asm retry check in the MIPS_ATOMIC_SET operation of the
sysmips system call has been backwards since commit f1e39a4a616c ("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: f1e39a4a616c ("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
Cc: stable@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/16148/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/syscall.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 53a7ef9a8f32..876c5a56931f 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -141,7 +141,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new) "1: ll %[old], (%[addr]) \n" " move %[tmp], %[new] \n" "2: sc %[tmp], (%[addr]) \n" - " bnez %[tmp], 4f \n" + " beqz %[tmp], 4f \n" "3: \n" " .insn \n" " .subsection 2 \n" |