[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-2bc872036e1c5948b5b02942810bbdd8dbdb9812@git.kernel.org>
Date: Wed, 14 Oct 2009 20:11:03 GMT
From: tip-bot for Darren Hart <dvhltc@...ibm.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, dvhltc@...ibm.com, hpa@...or.com,
mingo@...hat.com, eric.dumazet@...il.com, johnstul@...ibm.com,
peterz@...radead.org, dino@...ibm.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:core/urgent] futex: Check for NULL keys in match_futex
Commit-ID: 2bc872036e1c5948b5b02942810bbdd8dbdb9812
Gitweb: http://git.kernel.org/tip/2bc872036e1c5948b5b02942810bbdd8dbdb9812
Author: Darren Hart <dvhltc@...ibm.com>
AuthorDate: Wed, 14 Oct 2009 10:12:39 -0700
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 14 Oct 2009 22:00:14 +0200
futex: Check for NULL keys in match_futex
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@...ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...e.hu>
CC: Eric Dumazet <eric.dumazet@...il.com>
CC: Dinakar Guniguntala <dino@...ibm.com>
CC: John Stultz <johnstul@...ibm.com>
Cc: stable@...nel.org
LKML-Reference: <4AD60687.10306@...ibm.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
kernel/futex.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index 5c88839..06938e5 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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists