]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap()
authorWilliam Lee Irwin III <wli@holomorphy.com>
Wed, 25 May 2005 02:31:09 +0000 (19:31 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 25 May 2005 03:08:13 +0000 (20:08 -0700)
commit085aa19059cf3cb8cf04cbbed901e7dd0f5af8e0
treeee6a5305902cfd6abf818e398c538694db24dcb7
parent9dca427c44ae3627162c361a90eebd02620a5415
[PATCH] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap()

try_to_unmap_cluster() does:
        for (pte = pte_offset_map(pmd, address);
                        address < end; pte++, address += PAGE_SIZE) {
...
}

pte_unmap(pte);

It may take a little staring to notice, but pte can actually fall off the
end of the pte page in this iteration, which makes life difficult for
kmap_atomic() and the users not expecting it to BUG().  Of course, we're
somewhat lucky in that arithmetic elsewhere in the function guarantees that
at least one iteration is made, lest this force larger rearrangements to be
made.  This issue and patch also apply to non-mm mainline and with trivial
adjustments, at least two related kernels.

Discovered during internal testing at Oracle.

Signed-off-by: William Irwin <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/rmap.c