The patch titled Subject: mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix has been added to the -mm tree. Its filename is mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix fix CONFIG_MMU=n build Link: https://lkml.kernel.org/r/CA+G9fYuNS3k0DVT62twfV746pfNhCSrk5sVMcOcQ1PGGnEseyw@xxxxxxxxxxxxxx Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> Cc: Barry Song <song.bao.hua@xxxxxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) --- a/mm/gup.c~mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix +++ a/mm/gup.c @@ -1759,6 +1759,25 @@ static __always_inline long __gup_longte } #endif /* CONFIG_FS_DAX || CONFIG_CMA */ +static bool is_valid_gup_flags(unsigned int gup_flags) +{ + /* + * FOLL_PIN must only be set internally by the pin_user_pages*() APIs, + * never directly by the caller, so enforce that with an assertion: + */ + if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) + return false; + /* + * FOLL_PIN is a prerequisite to FOLL_LONGTERM. Another way of saying + * that is, FOLL_LONGTERM is a specific case, more restrictive case of + * FOLL_PIN. + */ + if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) + return false; + + return true; +} + #ifdef CONFIG_MMU static long __get_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, @@ -1789,25 +1808,6 @@ static long __get_user_pages_remote(stru gup_flags | FOLL_TOUCH | FOLL_REMOTE); } -static bool is_valid_gup_flags(unsigned int gup_flags) -{ - /* - * FOLL_PIN must only be set internally by the pin_user_pages*() APIs, - * never directly by the caller, so enforce that with an assertion: - */ - if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) - return false; - /* - * FOLL_PIN is a prerequisite to FOLL_LONGTERM. Another way of saying - * that is, FOLL_LONGTERM is a specific case, more restrictive case of - * FOLL_PIN. - */ - if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) - return false; - - return true; -} - /** * get_user_pages_remote() - pin user pages in memory * @mm: mm_struct of target mm _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm-slub-re-initialize-randomized-freelist-sequence-in-calculate_sizes-fix.patch mm.patch mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix.patch memblock-make-memblock_debug-and-related-functionality-private-fix.patch mm-vmstat-fix-proc-sys-vm-stat_refresh-generating-false-warnings-fix-2.patch kernel-forkc-export-kernel_thread-to-modules.patch