提交 2bc87203 编写于 作者: D Darren Hart 提交者: Thomas Gleixner

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: NDarren 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>
Cc: stable@kernel.org
LKML-Reference: <4AD60687.10306@us.ibm.com>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 d58e6576
...@@ -150,7 +150,8 @@ static struct futex_hash_bucket *hash_futex(union futex_key *key) ...@@ -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) 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.ptr == key2->both.ptr
&& key1->both.offset == key2->both.offset); && key1->both.offset == key2->both.offset);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册