summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHillf Danton <hdanton@sina.com>2020-04-08 11:59:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2020-04-08 09:05:58 -0700
commitae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25 (patch)
tree63df67653103289f0031d7956366af45ad01fe64
parentf5e94d10e4c468357019e5c28d48499f677b284f (diff)
mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal
__get_user_pages_locked() will return 0 instead of -EINTR after commit 4426e945df588 ("mm/gup: allow VM_FAULT_RETRY for multiple times") which added extra code to allow gup detect fatal signal faster. Restore the original -EINTR behavior. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Fixes: 4426e945df58 ("mm/gup: allow VM_FAULT_RETRY for multiple times") Reported-by: syzbot+3be1a33f04dc782e9fd5@syzkaller.appspotmail.com Signed-off-by: Hillf Danton <hdanton@sina.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/gup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/gup.c b/mm/gup.c
index afce0bc47e70..6076df8e04a4 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1326,8 +1326,11 @@ retry:
* start trying again otherwise it can loop forever.
*/
- if (fatal_signal_pending(current))
+ if (fatal_signal_pending(current)) {
+ if (!pages_done)
+ pages_done = -EINTR;
break;
+ }
ret = down_read_killable(&mm->mmap_sem);
if (ret) {