Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b29980e authored by Lorenzo Stoakes's avatar Lorenzo Stoakes Committed by Greg Kroah-Hartman
Browse files

mm: replace get_user_pages_unlocked() write/force parameters with gup_flags



commit c164154f66f0c9b02673f07aa4f044f1d9c70274 upstream.

This removes the 'write' and 'force' use from get_user_pages_unlocked()
and replaces them with 'gup_flags' to make the use of FOLL_FORCE
explicit in callers as use of this flag can result in surprising
behaviour (and hence bugs) within the mm subsystem.

Signed-off-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 4.4:
 - Also update calls from process_vm_rw_single_vec() and async_pf_execute()
 - Adjust context]
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ff099ed7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ slow_irqon:

	ret = get_user_pages_unlocked(current, mm, start,
				      (end - start) >> PAGE_SHIFT,
				      write, 0, pages);
				      pages, write ? FOLL_WRITE : 0);

	/* Have to be a bit careful with return values */
	if (nr > 0) {
+1 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
	start += nr << PAGE_SHIFT;
	pages += nr;
	ret = get_user_pages_unlocked(current, mm, start,
			     nr_pages - nr, write, 0, pages);
			     nr_pages - nr, pages, write ? FOLL_WRITE : 0);
	/* Have to be a bit careful with return values */
	if (nr > 0)
		ret = (ret < 0) ? nr : ret + nr;
+2 −1
Original line number Diff line number Diff line
@@ -258,7 +258,8 @@ slow_irqon:
		pages += nr;

		ret = get_user_pages_unlocked(current, mm, start,
			(end - start) >> PAGE_SHIFT, write, 0, pages);
			(end - start) >> PAGE_SHIFT, pages,
			write ? FOLL_WRITE : 0);

		/* Have to be a bit careful with return values */
		if (nr > 0) {
+2 −1
Original line number Diff line number Diff line
@@ -250,7 +250,8 @@ slow:
		pages += nr;

		ret = get_user_pages_unlocked(current, mm, start,
			(end - start) >> PAGE_SHIFT, write, 0, pages);
			(end - start) >> PAGE_SHIFT, pages,
			write ? FOLL_WRITE : 0);

		/* Have to be a bit careful with return values */
		if (nr > 0) {
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ slow_irqon:

		ret = get_user_pages_unlocked(current, mm, start,
					      (end - start) >> PAGE_SHIFT,
					      write, 0, pages);
					      pages, write ? FOLL_WRITE : 0);

		/* Have to be a bit careful with return values */
		if (nr > 0) {
Loading