The patch titled Subject: mm/pagewalk.c: prevent positive return value of walk_page_test() from being passed to callers has been added to the -mm tree. Its filename is mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers.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: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Subject: mm/pagewalk.c: prevent positive return value of walk_page_test() from being passed to callers walk_page_test() is purely pagewalk's internal stuff, and its positive return values are not intended to be passed to the callers of pagewalk. However, in the current code if the last vma in the do-while loop in walk_page_range() happens to return a positive value, it leaks outside walk_page_range(). So the user visible effect is invalid/unexpected return value (according to the reporter, mbind() causes it.) This patch fixes it simply by reinitializing the return value after checked. Another exposed interface, walk_page_vma(), already returns 0 for such cases so no problem. Fixes: fafaa4264eba ("pagewalk: improve vma handling") Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Signed-off-by: Kazutomo Yoshii <kazutomo.yoshii@xxxxxxxxx> Reported-by: Kazutomo Yoshii <kazutomo.yoshii@xxxxxxxxx> Acked-by: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/pagewalk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff -puN mm/pagewalk.c~mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers mm/pagewalk.c --- a/mm/pagewalk.c~mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers +++ a/mm/pagewalk.c @@ -265,8 +265,15 @@ int walk_page_range(unsigned long start, vma = vma->vm_next; err = walk_page_test(start, next, walk); - if (err > 0) + if (err > 0) { + /* + * positive return values are purely for + * controlling the pagewalk, so should never + * be passed to the callers. + */ + err = 0; continue; + } if (err < 0) break; } _ Patches currently in -mm which might be from n-horiguchi@xxxxxxxxxxxxx are mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers.patch mm-refactor-do_wp_page-extract-the-reuse-case.patch mm-refactor-do_wp_page-rewrite-the-unlock-flow.patch mm-refactor-do_wp_page-extract-the-page-copy-flow.patch mm-refactor-do_wp_page-handling-of-shared-vma-into-a-function.patch mm-mempolicy-migrate_to_node-should-only-migrate-to-node.patch do_shared_fault-check-that-mmap_sem-is-held.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