mm-gup-make-failure-to-pin-an-error-if-foll_nowait-not-specified.patch removed from -mm tree
The quilt patch titled
Subject: mm/gup: make failure to pin an error if FOLL_NOWAIT not specified
has been removed from the -mm tree. Its filename was
mm-gup-make-failure-to-pin-an-error-if-foll_nowait-not-specified.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Lorenzo Stoakes <[email protected]>
Subject: mm/gup: make failure to pin an error if FOLL_NOWAIT not specified
Date: Tue, 3 Oct 2023 00:14:53 +0100
There really should be no circumstances under which a non-FOLL_NOWAIT GUP operation fails to return any pages, so make this an error and warn on it.
To catch the trivial case, simply exit early if nr_pages == 0.
This brings __get_user_pages_locked() in line with the behaviour of its nommu variant.
---
mm/gup.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/gup.c renamed from mm/gup.c~mm-gup-make-failure-to-pin-an-error-if-foll_nowait-not-specified +11 -0
@@ -1471,6 +1471,9 @@ static __always_inline long __get_user_plong ret, pages_done;bool must_unlock = false; +if (!nr_pages) +return 0 ; +/* * The internal caller expects GUP to manage the lock internally and the * lock must be released when this returns.
@@ -1595,6 +1598,14 @@ retry:mmap_read_unlock (mm); *locked =0 ; } + +/* +* Failing to pin anything implies something has gone wrong (except when +* FOLL_NOWAIT is specified). +*/ +if (WARN_ON_ONCE (pages_done ==0 && !(flags &FOLL_NOWAIT ))) +return -EFAULT ; +return pages_done; }
_
Patches currently in -mm which might be from [email protected] are