From: tip-bot for Andi Kleen <andi@firstfloor.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dvhltc@us.ibm.com,
akpm@linuxfoundation.org, hpa@zytor.com, mingo@redhat.com,
andi@firstfloor.org, peterz@infradead.org, npiggin@suse.de,
ak@linux.intel.com, tglx@linutronix.de
Subject: [tip:core/urgent] futex: Take mmap_sem for get_user_pages in fault_in_user_writeable
Date: Tue, 8 Dec 2009 14:03:32 GMT [thread overview]
Message-ID: <tip-722d0172377a5697919b9f7e5beb95165b1dec4e@git.kernel.org> (raw)
In-Reply-To: <20091208121942.GA21298@basil.fritz.box>
Commit-ID: 722d0172377a5697919b9f7e5beb95165b1dec4e
Gitweb: http://git.kernel.org/tip/722d0172377a5697919b9f7e5beb95165b1dec4e
Author: Andi Kleen <andi@firstfloor.org>
AuthorDate: Tue, 8 Dec 2009 13:19:42 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 Dec 2009 14:59:36 +0100
futex: Take mmap_sem for get_user_pages in fault_in_user_writeable
get_user_pages() must be called with mmap_sem held.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: stable@kernel.org
Cc: Andrew Morton <akpm@linuxfoundation.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20091208121942.GA21298@basil.fritz.box>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/futex.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index fb65e82..d73ef1f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -304,8 +304,14 @@ void put_futex_key(int fshared, union futex_key *key)
*/
static int fault_in_user_writeable(u32 __user *uaddr)
{
- int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
- 1, 1, 0, NULL, NULL);
+ struct mm_struct *mm = current->mm;
+ int ret;
+
+ down_read(&mm->mmap_sem);
+ ret = get_user_pages(current, mm, (unsigned long)uaddr,
+ 1, 1, 0, NULL, NULL);
+ up_read(&mm->mmap_sem);
+
return ret < 0 ? ret : 0;
}
prev parent reply other threads:[~2009-12-08 14:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-08 12:19 [PATCH] futex: Take mmap_sem for get_user_pages in fault_in_user_writeable Andi Kleen
2009-12-08 11:26 ` Nick Piggin
2009-12-08 14:03 ` tip-bot for Andi Kleen [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-722d0172377a5697919b9f7e5beb95165b1dec4e@git.kernel.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=akpm@linuxfoundation.org \
--cc=dvhltc@us.ibm.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=npiggin@suse.de \
--cc=peterz@infradead.org \
--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