https://github.com/torvalds/linux
Revision 5ecb01cfdf96c5f465192bdb2a4fd4a61a24c6cc authored by Mikael Pettersson on 23 January 2010, 21:36:29 UTC, committed by Thomas Gleixner on 03 February 2010, 14:13:22 UTC
This fixes a futex key reference count bug in futex_lock_pi(),
where a key's reference count is incremented twice but decremented
only once, causing the backing object to not be released.

If the futex is created in a temporary file in an ext3 file system,
this bug causes the file's inode to become an "undead" orphan,
which causes an oops from a BUG_ON() in ext3_put_super() when the
file system is unmounted. glibc's test suite is known to trigger this,
see <http://bugzilla.kernel.org/show_bug.cgi?id=14256>.

The bug is a regression from 2.6.28-git3, namely Peter Zijlstra's
38d47c1b7075bd7ec3881141bb3629da58f88dab "[PATCH] futex: rely on
get_user_pages() for shared futexes". That commit made get_futex_key()
also increment the reference count of the futex key, and updated its
callers to decrement the key's reference count before returning.
Unfortunately the normal exit path in futex_lock_pi() wasn't corrected:
the reference count is incremented by get_futex_key() and queue_lock(),
but the normal exit path only decrements once, via unqueue_me_pi().
The fix is to put_futex_key() after unqueue_me_pi(), since 2.6.31
this is easily done by 'goto out_put_key' rather than 'goto out'.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
1 parent d6ad3e2
History
Tip revision: 5ecb01cfdf96c5f465192bdb2a4fd4a61a24c6cc authored by Mikael Pettersson on 23 January 2010, 21:36:29 UTC
futex_lock_pi() key refcnt fix
Tip revision: 5ecb01c
File Mode Size
Kconfig -rw-r--r-- 4.0 KB
Makefile -rw-r--r-- 669 bytes
chan.c -rw-r--r-- 2.1 KB
core.c -rw-r--r-- 21.2 KB
core.h -rw-r--r-- 12.2 KB
debugfs.c -rw-r--r-- 3.1 KB
debugfs.h -rw-r--r-- 300 bytes
ethtool.c -rw-r--r-- 1.1 KB
ethtool.h -rw-r--r-- 148 bytes
ibss.c -rw-r--r-- 11.4 KB
lib80211.c -rw-r--r-- 6.9 KB
lib80211_crypt_ccmp.c -rw-r--r-- 11.9 KB
lib80211_crypt_tkip.c -rw-r--r-- 21.0 KB
lib80211_crypt_wep.c -rw-r--r-- 7.3 KB
mlme.c -rw-r--r-- 18.1 KB
nl80211.c -rw-r--r-- 119.0 KB
nl80211.h -rw-r--r-- 2.6 KB
radiotap.c -rw-r--r-- 8.4 KB
reg.c -rw-r--r-- 60.5 KB
reg.h -rw-r--r-- 1.9 KB
scan.c -rw-r--r-- 25.4 KB
sme.c -rw-r--r-- 24.9 KB
sysfs.c -rw-r--r-- 2.4 KB
sysfs.h -rw-r--r-- 197 bytes
util.c -rw-r--r-- 17.8 KB
wext-compat.c -rw-r--r-- 37.8 KB
wext-compat.h -rw-r--r-- 1.9 KB
wext-core.c -rw-r--r-- 28.2 KB
wext-priv.c -rw-r--r-- 6.8 KB
wext-proc.c -rw-r--r-- 3.9 KB
wext-sme.c -rw-r--r-- 9.1 KB
wext-spy.c -rw-r--r-- 6.5 KB

back to top