Re: [PATCH] MIPS: Fix a long-standing mistake in mips_atomic_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Huacai,

On Thu, Jun 22, 2017 at 06:45:45PM +0800, Huacai Chen wrote:
> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>

Thats a coincidence. 8 years its been broken and I submitted an
identical patch only a few weeks ago, along with some other related
fixes:

https://patchwork.linux-mips.org/project/linux-mips/list/?series=313&state=*

Cheers
James

> ---
>  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
> 
> 
> 
> 

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux