The patch titled Subject: mm/migrate: fix indexing bug (off by one) and avoid out of bound access has been added to the -mm tree. Its filename is mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access.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: Mark Hairgrove <mhairgrove@xxxxxxxxxx> Subject: mm/migrate: fix indexing bug (off by one) and avoid out of bound access Index was incremented before last use and thus the second array could dereference to an invalid address (not mentioning the fact that it did not properly clear the entry we intended to clear). Link: http://lkml.kernel.org/r/1506973525-16491-1-git-send-email-jglisse@xxxxxxxxxx Fixes: 8315ada7f095bf ("mm/migrate: allow migrate_vma() to alloc new page on empty entry") Signed-off-by: Mark Hairgrove <mhairgrove@xxxxxxxxxx> Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN mm/migrate.c~mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access mm/migrate.c --- a/mm/migrate.c~mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access +++ a/mm/migrate.c @@ -2146,8 +2146,9 @@ static int migrate_vma_collect_hole(unsi unsigned long addr; for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { - migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE; + migrate->src[migrate->npages] = MIGRATE_PFN_MIGRATE; migrate->dst[migrate->npages] = 0; + migrate->npages++; migrate->cpages++; } _ Patches currently in -mm which might be from mhairgrove@xxxxxxxxxx are mm-migrate-fix-indexing-bug-off-by-one-and-avoid-out-of-bound-access.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