[PATCH] fix remap_pte_range BUG
authorHugh Dickins <hugh@veritas.com>
Wed, 22 Jun 2005 13:02:41 +0000 (14:02 +0100)
committerChris Wright <chrisw@osdl.org>
Wed, 29 Jun 2005 23:00:36 +0000 (16:00 -0700)
Out-of-tree user of remap_pfn_range hit kernel BUG at mm/memory.c:1112!
It passes an unrounded size to remap_pfn_range, which was okay before
2.6.12, but misses remap_pte_range's new end condition.  An audit of
all the other ptwalks confirms that this is the only one so exposed.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Chris Wright <chrisw@osdl.org>
mm/memory.c

index d209f745db7fbc3154e83cf04666770068986724..2f88f084fea52fa17af3c4c370497fa6f4803438 100644 (file)
@@ -1164,7 +1164,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
 {
        pgd_t *pgd;
        unsigned long next;
-       unsigned long end = addr + size;
+       unsigned long end = addr + PAGE_ALIGN(size);
        struct mm_struct *mm = vma->vm_mm;
        int err;