]> 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, 26 Jun 2014 00:42:46 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 26 Jun 2014 00:42:46 +0000 (10:42 +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 e119a8bf7b05a349621a255fe0ad19b9e9c83d93..09e2cd0d7feedfbeb50efaa3ad077cb1015f578f 100644 (file)
@@ -2970,6 +2970,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;