xtensa: fix futex_atomic_cmpxchg_inatomic
authorMax Filippov <jcmvbkbc@gmail.com>
Fri, 5 Jan 2018 22:27:58 +0000 (14:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:23:07 +0000 (20:23 +0100)
commite68d638e4931236aebcf3bf66f18136ba59f852e
tree1928bf93dfa331100e9b7c56746ffb471b5ffac0
parent12ab9e1e8d61b2384f97e2e6fb2a17aec677b01a
xtensa: fix futex_atomic_cmpxchg_inatomic

commit ca47480921587ae30417dd234a9f79af188e3666 upstream.

Return 0 if the operation was successful, not the userspace memory
value. Check that userspace value equals passed oldval, not itself.
Don't update *uval if the value wasn't read from userspace memory.

This fixes process hang due to infinite loop in futex_lock_pi.
It also fixes a bunch of glibc tests nptl/tst-mutexpi*.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/include/asm/futex.h