public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Sonny Rao <sonnyrao@us.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	sonnyrao@us.ibm.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:core/urgent] futexes: Fix infinite loop in get_futex_key() on huge page
Date: Sat, 11 Jul 2009 10:42:34 GMT	[thread overview]
Message-ID: <tip-ce2ae53b750abfaa012ce408e93da131a5b5649b@git.kernel.org> (raw)
In-Reply-To: <20090710231313.GA23572@us.ibm.com>

Commit-ID:  ce2ae53b750abfaa012ce408e93da131a5b5649b
Gitweb:     http://git.kernel.org/tip/ce2ae53b750abfaa012ce408e93da131a5b5649b
Author:     Sonny Rao <sonnyrao@us.ibm.com>
AuthorDate: Fri, 10 Jul 2009 18:13:13 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 11 Jul 2009 12:40:44 +0200

futexes: Fix infinite loop in get_futex_key() on huge page

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: stable@kernel.org
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>


---
 kernel/futex.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 794c862..0672ff8 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -247,6 +247,7 @@ again:
 	if (err < 0)
 		return err;
 
+	page = compound_head(page);
 	lock_page(page);
 	if (!page->mapping) {
 		unlock_page(page);

      parent reply	other threads:[~2009-07-11 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 23:13 [PATCH] futexs: fix infinite loop in get_futex_key on huge page Sonny Rao
2009-07-11  8:19 ` Ingo Molnar
2009-07-11 10:14   ` Thomas Gleixner
2009-07-11  8:22 ` [tip:core/urgent] futexes: Fix infinite loop in get_futex_key() " tip-bot for Sonny Rao
2009-07-11 10:42 ` tip-bot for Sonny Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-ce2ae53b750abfaa012ce408e93da131a5b5649b@git.kernel.org \
    --to=sonnyrao@us.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox