]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
do_shared_fault(): check that mmap_sem is held
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 22 May 2014 00:43:28 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:28 +0000 (10:43 +1000)
mmap_sem() is required to protect the vma, which holds ->vm_file, which
pins fault_page->mapping.

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Bob Liu <lliubbo@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c

index 3f4e697b864653f77f54a8b022cd61b5d389eb98..fd16b767dd68cbf32e5a9f8f48903fcaad185800 100644 (file)
@@ -2954,6 +2954,8 @@ static int do_shared_fault(struct mm_struct *mm, struct vm_area_struct *vma,
        int dirtied = 0;
        int ret, tmp;
 
+       WARN_ON_ONCE(!rwsem_is_locked(&mm->mmap_sem));
+
        ret = __do_fault(vma, address, pgoff, flags, &fault_page);
        if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
                return ret;