mm-gup-use-unpin_user_pages-in-__gup_longterm_locked.patch removed from -mm tree
The patch titled
Subject: mm/gup: use unpin_user_pages() in __gup_longterm_locked()
has been removed from the -mm tree. Its filename was
mm-gup-use-unpin_user_pages-in-__gup_longterm_locked.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Jason Gunthorpe <[email protected]>
Subject: mm/gup: use unpin_user_pages() in __gup_longterm_locked()
When FOLL_PIN is passed to __get_user_pages() the page list must be put back using unpin_user_pages() otherwise the page pin reference persists in a corrupted state.
There are two places in the unwind of __gup_longterm_locked() that put the pages back without checking. Normally on error this function would return the partial page list making this the caller's responsibility, but in these two cases the caller is not allowed to see these pages at all.
---
mm/gup.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-gup-use-unpin_user_pages-in-__gup_longterm_locked +10 -4
@@ -1647,8 +1647,11 @@ check_again:/* * drop the above get_user_pages reference. */ -for (i =0 ; i < nr_pages; i++) -put_page (pages[i]); +if (gup_flags &FOLL_PIN ) +unpin_user_pages (pages, nr_pages); +else +for (i =0 ; i < nr_pages; i++) +put_page (pages[i]);if (migrate_pages (&cma_page_list, alloc_migration_target,NULL , (unsigned long )&mtc,MIGRATE_SYNC ,MR_CONTIG_RANGE )) {
@@ -1728,8 +1731,11 @@ static long __gup_longterm_locked(struct goto out;if (check_dax_vmas (vmas_tmp, rc)) { -for (i =0 ; i < rc; i++) -put_page (pages[i]); +if (gup_flags &FOLL_PIN ) +unpin_user_pages (pages, rc); +else +for (i =0 ; i < rc; i++) +put_page (pages[i]); rc = -EOPNOTSUPP ; goto out; }
_
Patches currently in -mm which might be from [email protected] are
mm-reorganize-internal_get_user_pages_fast.patch mm-prevent-gup_fast-from-racing-with-cow-during-fork.patch