The patch titled Subject: mm/gup: introduce pin_user_pages_locked() has been added to the -mm tree. Its filename is mm-gup-introduce-pin_user_pages_locked-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-gup-introduce-pin_user_pages_locked-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-introduce-pin_user_pages_locked-v2.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: John Hubbard <jhubbard@xxxxxxxxxx> Subject: mm/gup: introduce pin_user_pages_locked() add an assert-and-return to the corresponding get_user_pages_locked() call, to keep out any externally set FOLL_PIN flag, Link: http://lkml.kernel.org/r/20200531234131.770697-2-jhubbard@xxxxxxxxxx Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Acked-by: Pankaj Gupta <pankaj.gupta.linux@xxxxxxxxx> Cc: Souptick Joarder <jrdr.linux@xxxxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: Dave Chinner <david@xxxxxxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Jérôme Glisse <jglisse@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/mm/gup.c~mm-gup-introduce-pin_user_pages_locked-v2 +++ a/mm/gup.c @@ -2020,6 +2020,12 @@ long get_user_pages_locked(unsigned long */ if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) return -EINVAL; + /* + * FOLL_PIN must only be set internally by the pin_user_pages*() APIs, + * never directly by the caller, so enforce that: + */ + if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) + return -EINVAL; return __get_user_pages_locked(current, current->mm, start, nr_pages, pages, NULL, locked, _ Patches currently in -mm which might be from jhubbard@xxxxxxxxxx are mm-gup-introduce-pin_user_pages_unlocked.patch ivtv-convert-get_user_pages-pin_user_pages.patch mm-gup-move-__get_user_pages_fast-down-a-few-lines-in-gupc.patch mm-gup-refactor-and-de-duplicate-gup_fast-code.patch mm-gup-refactor-and-de-duplicate-gup_fast-code-fix.patch mm-gup-introduce-pin_user_pages_fast_only.patch drm-i915-convert-get_user_pages-pin_user_pages.patch mm-gup-might_lock_readmmap_sem-in-get_user_pages_fast.patch khugepaged-add-self-test-fix-3.patch rapidio-convert-get_user_pages-pin_user_pages.patch mm-gup-update-pin_user_pagesrst-for-case-3-mmu-notifiers.patch mm-gup-introduce-pin_user_pages_locked.patch mm-gup-introduce-pin_user_pages_locked-v2.patch mm-gup-frame_vector-convert-get_user_pages-pin_user_pages.patch mm-gup-documentation-fix-for-pin_user_pages-apis.patch