summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2014-04-23 08:27:23 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-04-23 08:27:23 +1000
commit57ccff592966aa5813aca76ddd9f18c3d6f9009d (patch)
treec5259ec089451b2e7bf1eaff587457696e2399b2 /mm
parent4a406d057d1bd9b536b73929b90219fdaa1be3c1 (diff)
do_shared_fault(): check that mmap_sem is held
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index eac7c41456fd..7e6a74f57639 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2944,6 +2944,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;