aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel
diff options
context:
space:
mode:
authorDavidlohr Bueso <davidlohr@hp.com>2014-06-04 19:07:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:00 -0400
commit5040573e49cc8f0e016a83544a0e552f2f44c897 (patch)
tree5c7db141f650f8d427d9e8984d2b4ead9e266635 /arch/arc/kernel
parent2ee06468702e0742114823a537510cd6f038cacc (diff)
arc: call find_vma with the mmap_sem held
Performing vma lookups without taking the mm->mmap_sem is asking for trouble. While doing the search, the vma in question can be modified or even removed before returning to the caller. Take the lock (shared) in order to avoid races while iterating through the vmacache and/or rbtree. [akpm@linux-foundation.org: CSE current->active_mm, per Vineet] Signed-off-by: Davidlohr Bueso <davidlohr@hp.com> Acked-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arc/kernel')
-rw-r--r--arch/arc/kernel/troubleshoot.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 73a7450ee622..1badf9b84b51 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -86,12 +86,13 @@ static void show_faulting_vma(unsigned long address, char *buf)
86 unsigned long ino = 0; 86 unsigned long ino = 0;
87 dev_t dev = 0; 87 dev_t dev = 0;
88 char *nm = buf; 88 char *nm = buf;
89 struct mm_struct *active_mm = current->active_mm;
89 90
90 /* can't use print_vma_addr() yet as it doesn't check for 91 /* can't use print_vma_addr() yet as it doesn't check for
91 * non-inclusive vma 92 * non-inclusive vma
92 */ 93 */
93 94 down_read(&active_mm->mmap_sem);
94 vma = find_vma(current->active_mm, address); 95 vma = find_vma(active_mm, address);
95 96
96 /* check against the find_vma( ) behaviour which returns the next VMA 97 /* check against the find_vma( ) behaviour which returns the next VMA
97 * if the container VMA is not found 98 * if the container VMA is not found
@@ -110,9 +111,10 @@ static void show_faulting_vma(unsigned long address, char *buf)
110 vma->vm_start < TASK_UNMAPPED_BASE ? 111 vma->vm_start < TASK_UNMAPPED_BASE ?
111 address : address - vma->vm_start, 112 address : address - vma->vm_start,
112 nm, vma->vm_start, vma->vm_end); 113 nm, vma->vm_start, vma->vm_end);
113 } else { 114 } else
114 pr_info(" @No matching VMA found\n"); 115 pr_info(" @No matching VMA found\n");
115 } 116
117 up_read(&active_mm->mmap_sem);
116} 118}
117 119
118static void show_ecr_verbose(struct pt_regs *regs) 120static void show_ecr_verbose(struct pt_regs *regs)