The patch titled Subject: mm: don't dereference struct page fields of invalid pages has been added to the -mm tree. Its filename is mm-dont-dereference-struct-page-fields-of-invalid-pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-dont-dereference-struct-page-fields-of-invalid-pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-dont-dereference-struct-page-fields-of-invalid-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> Subject: mm: don't dereference struct page fields of invalid pages The VM_BUG_ON() check in move_freepages() checks whether the node id of a page matches the node id of its zone. However, it does this before having checked whether the struct page pointer refers to a valid struct page to begin with. This is guaranteed in most cases, but may not be the case if CONFIG_HOLES_IN_ZONE=y. So reorder the VM_BUG_ON() with the pfn_valid_within() check. Link: http://lkml.kernel.org/r/1481706707-6211-2-git-send-email-ard.biesheuvel@xxxxxxxxxx Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Hanjun Guo <hanjun.guo@xxxxxxxxxx> Cc: Yisheng Xie <xieyisheng1@xxxxxxxxxx> Cc: Robert Richter <rrichter@xxxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -puN mm/page_alloc.c~mm-dont-dereference-struct-page-fields-of-invalid-pages mm/page_alloc.c --- a/mm/page_alloc.c~mm-dont-dereference-struct-page-fields-of-invalid-pages +++ a/mm/page_alloc.c @@ -1864,14 +1864,14 @@ int move_freepages(struct zone *zone, #endif for (page = start_page; page <= end_page;) { - /* Make sure we are not inadvertently changing nodes */ - VM_BUG_ON_PAGE(page_to_nid(page) != zone_to_nid(zone), page); - if (!pfn_valid_within(page_to_pfn(page))) { page++; continue; } + /* Make sure we are not inadvertently changing nodes */ + VM_BUG_ON_PAGE(page_to_nid(page) != zone_to_nid(zone), page); + if (!PageBuddy(page)) { page++; continue; _ Patches currently in -mm which might be from ard.biesheuvel@xxxxxxxxxx are mm-dont-dereference-struct-page-fields-of-invalid-pages.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html