summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/gup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/gup.c b/mm/gup.c
index 90262e448552..a6c20a7b3c49 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1320,7 +1320,7 @@ static __always_inline long __get_user_pages_locked(struct mm_struct *mm,
BUG_ON(*locked != 1);
}
- if (flags & FOLL_PIN)
+ if ((flags & FOLL_PIN) && !atomic_read(&mm->has_pinned))
atomic_set(&mm->has_pinned, 1);
/*
@@ -2641,7 +2641,7 @@ static int internal_get_user_pages_fast(unsigned long start,
FOLL_FAST_ONLY)))
return -EINVAL;
- if (gup_flags & FOLL_PIN)
+ if ((gup_flags & FOLL_PIN) && !atomic_read(&current->mm->has_pinned))
atomic_set(&current->mm->has_pinned, 1);
if (!(gup_flags & FOLL_FAST_ONLY))