aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-06-15 11:43:25 -0400
committerIngo Molnar <mingo@kernel.org>2012-06-16 03:10:42 -0400
commitcc359d180fa9c25a4c1819f17e07a422d788353d (patch)
tree98a70566b1bba99878990b9ac5143b3778bdff0b /kernel/events
parentea131377148cdfe90641b42ae9aa5a6b3a4fa327 (diff)
uprobes: __copy_insn() should ensure a_ops->readpage != NULL
__copy_insn() blindly calls read_mapping_page(), this will crash the kernel if ->readpage == NULL, add the necessary check. For example, hugetlbfs_aops->readpage is NULL. Perhaps we should change read_mapping_page() instead. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: 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/20120615154325.GA9568@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/uprobes.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index f0d04530af63..604930bf9c92 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -610,6 +610,9 @@ __copy_insn(struct address_space *mapping, struct vm_area_struct *vma, char *ins
610 if (!filp) 610 if (!filp)
611 return -EINVAL; 611 return -EINVAL;
612 612
613 if (!mapping->a_ops->readpage)
614 return -EIO;
615
613 idx = (unsigned long)(offset >> PAGE_CACHE_SHIFT); 616 idx = (unsigned long)(offset >> PAGE_CACHE_SHIFT);
614 off1 = offset &= ~PAGE_MASK; 617 off1 = offset &= ~PAGE_MASK;
615 618