public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Fix a long-standing mistake in mips_atomic_set()
@ 2017-06-22 10:45 Huacai Chen
  2017-06-22 12:31 ` James Hogan
  0 siblings, 1 reply; 3+ messages in thread
From: Huacai Chen @ 2017-06-22 10:45 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: John Crispin, Steven J . Hill, linux-mips, Fuxin Zhang,
	Zhangjin Wu, Huacai Chen, stable

This mistake comes from the commit f1e39a4a616cd99 ("MIPS: Rewrite
sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler"). In the
common case 'bnez' should be 'beqz' (as same as older kernels before
2.6.32), otherwise this syscall may cause an endless loop.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/kernel/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 1dfa7f5..95e1b30 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -134,7 +134,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"
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-22 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 10:45 [PATCH] MIPS: Fix a long-standing mistake in mips_atomic_set() Huacai Chen
2017-06-22 12:31 ` James Hogan
2017-06-22 12:50   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox