diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-06-15 11:43:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-06-16 03:10:47 -0400 |
commit | eb2bf57bee42c7565032f93adaa211e2c9fcc52c (patch) | |
tree | 98eb3ecffb5e8489b6a026788880e80f5f9a1a92 /kernel | |
parent | fc36f59565861af2e897225bc3782479a26c5d5a (diff) |
uprobes: No need to re-check vma_address() in write_opcode()
write_opcode() is called by register_for_each_vma() and
uprobe_mmap() paths. In both cases the caller has already
verified this vaddr under mmap_sem, no need to re-check.
Note also that this check is wrong anyway, we should not
truncate loff_t returned by vma_address() if we do not trust
this mapping.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120615154347.GA9604@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/uprobes.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 2db1d94d7dfc..14c71a2aadad 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -211,7 +211,6 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, | |||
211 | struct vm_area_struct *vma; | 211 | struct vm_area_struct *vma; |
212 | struct uprobe *uprobe; | 212 | struct uprobe *uprobe; |
213 | unsigned long pgoff; | 213 | unsigned long pgoff; |
214 | loff_t addr; | ||
215 | int ret; | 214 | int ret; |
216 | retry: | 215 | retry: |
217 | /* Read the page with vaddr into memory */ | 216 | /* Read the page with vaddr into memory */ |
@@ -235,10 +234,6 @@ retry: | |||
235 | if (mapping != vma->vm_file->f_mapping) | 234 | if (mapping != vma->vm_file->f_mapping) |
236 | goto put_out; | 235 | goto put_out; |
237 | 236 | ||
238 | addr = vma_address(vma, uprobe->offset); | ||
239 | if (vaddr != (unsigned long)addr) | ||
240 | goto put_out; | ||
241 | |||
242 | ret = -ENOMEM; | 237 | ret = -ENOMEM; |
243 | new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr); | 238 | new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr); |
244 | if (!new_page) | 239 | if (!new_page) |