Skip to content

Commit

Permalink
mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal
Browse files Browse the repository at this point in the history
__get_user_pages_locked() will return 0 instead of -EINTR after commit
4426e94 ("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: 4426e94 ("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>
  • Loading branch information
Hillf Danton authored and torvalds committed Apr 8, 2020
1 parent f5e94d1 commit ae46d2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mm/gup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,11 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
* 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) {
Expand Down

0 comments on commit ae46d2a

Please sign in to comment.