diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index d08acdae0036..00ffa974c90c 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1039,6 +1039,7 @@ unsigned long do_mremap(unsigned long addr, | |||
1039 | 1039 | ||
1040 | /* | 1040 | /* |
1041 | * Look up the first VMA which satisfies addr < vm_end, NULL if none | 1041 | * Look up the first VMA which satisfies addr < vm_end, NULL if none |
1042 | * - should be called with mm->mmap_sem at least readlocked | ||
1042 | */ | 1043 | */ |
1043 | struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) | 1044 | struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) |
1044 | { | 1045 | { |
@@ -1213,7 +1214,6 @@ struct page *filemap_nopage(struct vm_area_struct *area, | |||
1213 | */ | 1214 | */ |
1214 | int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) | 1215 | int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) |
1215 | { | 1216 | { |
1216 | struct vm_list_struct *vml; | ||
1217 | struct vm_area_struct *vma; | 1217 | struct vm_area_struct *vma; |
1218 | struct mm_struct *mm; | 1218 | struct mm_struct *mm; |
1219 | 1219 | ||
@@ -1227,13 +1227,8 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in | |||
1227 | down_read(&mm->mmap_sem); | 1227 | down_read(&mm->mmap_sem); |
1228 | 1228 | ||
1229 | /* the access must start within one of the target process's mappings */ | 1229 | /* the access must start within one of the target process's mappings */ |
1230 | for (vml = mm->context.vmlist; vml; vml = vml->next) | 1230 | vma = find_vma(mm, addr); |
1231 | if (addr >= vml->vma->vm_start && addr < vml->vma->vm_end) | 1231 | if (vma) { |
1232 | break; | ||
1233 | |||
1234 | if (vml) { | ||
1235 | vma = vml->vma; | ||
1236 | |||
1237 | /* don't overrun this mapping */ | 1232 | /* don't overrun this mapping */ |
1238 | if (addr + len >= vma->vm_end) | 1233 | if (addr + len >= vma->vm_end) |
1239 | len = vma->vm_end - addr; | 1234 | len = vma->vm_end - addr; |