• David Gibson's avatar
    powerpc/mm: Fix bug in gup_hugepd() · 39adfa54
    David Gibson authored
    Commit a4fe3ce7 introduced a new
    get_user_pages() path for hugepages on powerpc.  Unfortunately, there
    is a bug in it's loop logic, which can cause it to overrun the end of
    the intended region.  This came about by copying the logic from the
    normal page path, which assumes the address and end parameters have
    been pagesize aligned at the top-level.  Since they're not *hugepage*
    size aligned, the simplistic logic could step over the end of the gup
    region without triggering the loop end condition.
    
    This patch fixes the bug by using the technique that the normal page
    path uses in levels above the lowest to truncate the ending address to
    something we know we'll match with.
    Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    39adfa54
hugetlbpage.c 13.1 KB