Return-Path: Received: from smtpbgau2.qq.com ([54.206.34.216]:58562 "EHLO smtpbgau2.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbdFVKpW (ORCPT ); Thu, 22 Jun 2017 06:45:22 -0400 From: Huacai Chen To: Ralf Baechle Cc: John Crispin , "Steven J . Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , stable@vger.kernel.org Subject: [PATCH] MIPS: Fix a long-standing mistake in mips_atomic_set() Date: Thu, 22 Jun 2017 18:45:45 +0800 Message-Id: <1498128345-6827-1-git-send-email-chenhc@lemote.com> Sender: stable-owner@vger.kernel.org List-ID: 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 --- 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