uprobes: __copy_insn() should ensure a_ops->readpage != NULL
authorOleg Nesterov <[email protected]>
Fri, 15 Jun 2012 15:43:25 +0000 (17:43 +0200)
committerIngo Molnar <[email protected]>
Sat, 16 Jun 2012 07:10:42 +0000 (09:10 +0200)
__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 <[email protected]>
Acked-by: Srikar Dronamraju <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
Cc: Anton Arapov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/events/uprobes.c

index f0d04530af632f0fad0575d35204d9096600110a..604930bf9c92a39942f931982436ae45d2ba6b1d 100644 (file)
@@ -610,6 +610,9 @@ __copy_insn(struct address_space *mapping, struct vm_area_struct *vma, char *ins
        if (!filp)
                return -EINVAL;
 
+       if (!mapping->a_ops->readpage)
+               return -EIO;
+
        idx = (unsigned long)(offset >> PAGE_CACHE_SHIFT);
        off1 = offset &= ~PAGE_MASK;