powerpc: Fix data-corrupting bug in __futex_atomic_op
authorPaul Mackerras <paulus@samba.org>
Wed, 15 Apr 2009 17:25:05 +0000 (17:25 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 2 May 2009 17:56:50 +0000 (10:56 -0700)
commit58990be4f35616f120d734fd0d63fabaa17049cd
tree68818c830e32fb6dc7b6d1072873207dd13791f6
parent2e59b05f014868ffaa019923cc6b4953110d006b
powerpc: Fix data-corrupting bug in __futex_atomic_op

upstream commit: 306a82881b14d950d59e0b59a55093a07d82aa9a

Richard Henderson pointed out that the powerpc __futex_atomic_op has a
bug: it will write the wrong value if the stwcx. fails and it has to
retry the lwarx/stwcx. loop, since 'oparg' will have been overwritten
by the result from the first time around the loop.  This happens
because it uses the same register for 'oparg' (an input) as it uses
for the result.

This fixes it by using separate registers for 'oparg' and 'ret'.

Cc: stable@kernel.org
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/powerpc/include/asm/futex.h