lkml.org 
[lkml]   [2009]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[11/90] futex: Take mmap_sem for get_user_pages in fault_in_user_writeable
    2.6.31-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Andi Kleen <andi@firstfloor.org>

    commit 722d0172377a5697919b9f7e5beb95165b1dec4e upstream.

    get_user_pages() must be called with mmap_sem held.

    Signed-off-by: Andi Kleen <ak@linux.intel.com>
    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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    kernel/futex.c | 10 ++++++++--
    1 file changed, 8 insertions(+), 2 deletions(-)

    --- a/kernel/futex.c
    +++ b/kernel/futex.c
    @@ -303,8 +303,14 @@ void put_futex_key(int fshared, union fu
    */
    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;
    }




    \
     
     \ /
      Last update: 2009-12-17 02:51    [W:0.020 / U:121.432 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site