]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commit
futex: Fix errors in nested key ref-counting
authorDarren Hart <dvhart@linux.intel.com>
Sun, 17 Oct 2010 15:35:04 +0000 (08:35 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Nov 2010 19:03:02 +0000 (11:03 -0800)
commit380c7ff30fb28ea236d1543e220c52de7d65343a
tree0f2692ca7f0c31d6f6739e2fc726189b61f57075
parent8f836cca356e9b42c52a160bd945aad5e7173691
futex: Fix errors in nested key ref-counting

commit 7ada876a8703f23befbb20a7465a702ee39b1704 upstream.

futex_wait() is leaking key references due to futex_wait_setup()
acquiring an additional reference via the queue_lock() routine. The
nested key ref-counting has been masking bugs and complicating code
analysis. queue_lock() is only called with a previously ref-counted
key, so remove the additional ref-counting from the queue_(un)lock()
functions.

Also futex_wait_requeue_pi() drops one key reference too many in
unqueue_me_pi(). Remove the key reference handling from
unqueue_me_pi(). This was paired with a queue_lock() in
futex_lock_pi(), so the count remains unchanged.

Document remaining nested key ref-counting sites.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Reported-and-tested-by: Matthieu Fertré<matthieu.fertre@kerlabs.com>
Reported-by: Louis Rilling<louis.rilling@kerlabs.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
LKML-Reference: <4CBB17A8.70401@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/futex.c