futex: Sanitize cmpxchg_futex_value_locked API
commit37a9d912b24f96a0591773e6e6c3642991ae5a70
authorMichel Lespinasse <walken@google.com>
Fri, 11 Mar 2011 02:48:51 +0000 (10 18:48 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 11 Mar 2011 11:23:08 +0000 (11 12:23 +0100)
tree5c4d5b9a52e2c533269e589115afbd25b6c8534b
parent522d7decc0370070448a8c28982c8dfd8970489e
futex: Sanitize cmpxchg_futex_value_locked API

The cmpxchg_futex_value_locked API was funny in that it returned either
the original, user-exposed futex value OR an error code such as -EFAULT.
This was confusing at best, and could be a source of livelocks in places
that retry the cmpxchg_futex_value_locked after trying to fix the issue
by running fault_in_user_writeable().

This change makes the cmpxchg_futex_value_locked API more similar to the
get_futex_value_locked one, returning an error code and updating the
original value through a reference argument.

Signed-off-by: Michel Lespinasse <walken@google.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [tile]
Acked-by: Tony Luck <tony.luck@intel.com> [ia64]
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu> [microblaze]
Acked-by: David Howells <dhowells@redhat.com> [frv]
Cc: Darren Hart <darren@dvhart.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <20110311024851.GC26122@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
20 files changed:
arch/alpha/include/asm/futex.h
arch/arm/include/asm/futex.h
arch/frv/include/asm/futex.h
arch/ia64/include/asm/futex.h
arch/microblaze/include/asm/futex.h
arch/mips/include/asm/futex.h
arch/parisc/include/asm/futex.h
arch/powerpc/include/asm/futex.h
arch/s390/include/asm/futex.h
arch/s390/include/asm/uaccess.h
arch/s390/lib/uaccess.h
arch/s390/lib/uaccess_pt.c
arch/s390/lib/uaccess_std.c
arch/sh/include/asm/futex-irq.h
arch/sh/include/asm/futex.h
arch/sparc/include/asm/futex_64.h
arch/tile/include/asm/futex.h
arch/x86/include/asm/futex.h
include/asm-generic/futex.h
kernel/futex.c