summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonny Rao <sonnyrao@us.ibm.com>2009-07-10 18:13:13 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-07-19 20:38:50 -0700
commiteadc4345f93b857cbf8c63400ea0a7ed9b6431a2 (patch)
tree8ffafc9bfd16d794731bf5739d84ad4ab4b3a57a
parent434f5f9696e76352c4e23b3fa99881e87149da66 (diff)
futexes: Fix infinite loop in get_futex_key() on huge page
commit ce2ae53b750abfaa012ce408e93da131a5b5649b upstream. get_futex_key() can infinitely loop if it is called on a virtual address that is within a huge page but not aligned to the beginning of that page. The call to get_user_pages_fast will return the struct page for a sub-page within the huge page and the check for page->mapping will always fail. The fix is to call compound_head on the page before checking that it's mapped. Signed-off-by: Sonny Rao <sonnyrao@us.ibm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: anton@samba.org Cc: rajamony@us.ibm.com Cc: speight@us.ibm.com Cc: mstephen@us.ibm.com Cc: grimm@us.ibm.com Cc: mikey@ozlabs.au.ibm.com LKML-Reference: <20090710231313.GA23572@us.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--kernel/futex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index f2cee4b24c51..4d973bde8533 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -241,6 +241,7 @@ again:
if (err < 0)
return err;
+ page = compound_head(page);
lock_page(page);
if (!page->mapping) {
unlock_page(page);