diff options
author | Darren Hart <dvhltc@us.ibm.com> | 2009-10-14 10:12:39 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-11-09 16:21:52 -0800 |
commit | 6d57fbdd82f6012a4d451bacd75451928cbc29be (patch) | |
tree | 643aa6e7d7f6ec60742e399b9b4e88e3191771bd /kernel | |
parent | e68e25e608880c149c2080930295227a79ceb5ac (diff) | |
download | linux-stable-6d57fbdd82f6012a4d451bacd75451928cbc29be.tar.gz linux-stable-6d57fbdd82f6012a4d451bacd75451928cbc29be.tar.bz2 linux-stable-6d57fbdd82f6012a4d451bacd75451928cbc29be.zip |
futex: Check for NULL keys in match_futex
commit 2bc872036e1c5948b5b02942810bbdd8dbdb9812 upstream.
If userspace tries to perform a requeue_pi on a non-requeue_pi waiter,
it will find the futex_q->requeue_pi_key to be NULL and OOPS.
Check for NULL in match_futex() instead of doing explicit NULL pointer
checks on all call sites. While match_futex(NULL, NULL) returning
false is a little odd, it's still correct as we expect valid key
references.
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Dinakar Guniguntala <dino@in.ibm.com>
CC: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <4AD60687.10306@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/futex.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index daed2619371b..dcd98ec595fa 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -150,7 +150,8 @@ static struct futex_hash_bucket *hash_futex(union futex_key *key) */ static inline int match_futex(union futex_key *key1, union futex_key *key2) { - return (key1->both.word == key2->both.word + return (key1 && key2 + && key1->both.word == key2->both.word && key1->both.ptr == key2->both.ptr && key1->both.offset == key2->both.offset); } |