]> git.hungrycats.org Git - linux/commitdiff
[PATCH] vmalloc address offset fix
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:41:50 +0000 (18:41 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:41:50 +0000 (18:41 -0800)
From: Anton Blanchard <anton@samba.org>

Paul wrote a patch to use some of the rmap infrastructure to flush TLB
entries on ppc64.  When testing it we found a problem in vmalloc where it
sets up the pte -> address mapping incorrectly.  We clear the top bits of
the address but then forget to pass in the full address to
pte_alloc_kernel.  The end result is the address in page->index is
truncated.

I fixed it in a similar way to how zeromap_pmd_range etc does it.  I'm
guessing no one uses the rmap hooks on vmalloc pages yet, so havent seen
this problem.

mm/vmalloc.c

index 2d3022d2c859910d7e023cd41dfe9c20aa4b9495..c7f7018278b43deef91770a8eeddfe9dbda02493 100644 (file)
@@ -114,15 +114,16 @@ static int map_area_pmd(pmd_t *pmd, unsigned long address,
                               unsigned long size, pgprot_t prot,
                               struct page ***pages)
 {
-       unsigned long end;
+       unsigned long base, end;
 
+       base = address & PGDIR_MASK;
        address &= ~PGDIR_MASK;
        end = address + size;
        if (end > PGDIR_SIZE)
                end = PGDIR_SIZE;
 
        do {
-               pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
+               pte_t * pte = pte_alloc_kernel(&init_mm, pmd, base + address);
                if (!pte)
                        return -ENOMEM;
                if (map_area_pte(pte, address, end - address, prot, pages))