fs/proc/task_mmu.c: hold read lock on mm->mmap_sem for get_user_pages
Vandana Salve [Wed, 25 Jun 2014 15:01:37 +0000 (20:01 +0530)]
Hold read lock on mm->mmap_sem for calling get_user_pages

bug 1525355

Change-Id: I4a1b607c9f745ea938d7f051e76d67425eccd09d
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/428367
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

fs/proc/task_mmu.c

index db17f98..a9e45c7 100644 (file)
@@ -158,8 +158,10 @@ static void seq_print_vma_name(struct seq_file *m, struct vm_area_struct *vma)
                long pages_pinned;
                struct page *page;
 
+               down_read(&current->mm->mmap_sem);
                pages_pinned = get_user_pages(current, mm, page_start_vaddr,
                                1, 0, 0, &page, NULL);
+               up_read(&current->mm->mmap_sem);
                if (pages_pinned < 1) {
                        seq_puts(m, "<fault>]");
                        return;