From 8bd06762ffd14e60934e612481c244769efebd6b Mon Sep 17 00:00:00 2001 From: Hillf Danton Date: Wed, 8 Apr 2020 11:59:24 -0400 Subject: [PATCH] UPSTREAM: 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 Cc: Thomas Gleixner Cc: Peter Zijlstra Fixes: 4426e945df58 ("mm/gup: allow VM_FAULT_RETRY for multiple times") Reported-by: syzbot+3be1a33f04dc782e9fd5@syzkaller.appspotmail.com Signed-off-by: Hillf Danton Acked-by: Michal Hocko Signed-off-by: Peter Xu Signed-off-by: Linus Torvalds (cherry picked from commit ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25) Bug: 176847924 Signed-off-by: Kalesh Singh Change-Id: Ic812596b077e7b5fbfde90f2253241afa1fa42cf --- mm/gup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index e3fa43a76fe6..99c83218f6a3 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1098,8 +1098,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) {