Commit e86b298b authored by Mike Rapoport's avatar Mike Rapoport Committed by Linus Torvalds
Browse files

userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage

When the process exit races with outstanding mcopy_atomic, it would be
better to return ESRCH error.  When such race occurs the process and
it's mm are going away and returning "no such process" to the uffd
monitor seems better fit than ENOSPC.


Signed-off-by: default avatarMike Rapoport <>
Suggested-by: default avatarMichal Hocko <>
Acked-by: default avatarMichal Hocko <>
Cc: Andrea Arcangeli <>
Cc: "Dr. David Alan Gilbert" <>
Cc: Pavel Emelyanov <>
Cc: Mike Kravetz <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f357e345
......@@ -1600,7 +1600,7 @@ static int userfaultfd_copy(struct userfaultfd_ctx *ctx,
} else {
return -ENOSPC;
return -ESRCH;
if (unlikely(put_user(ret, &user_uffdio_copy->copy)))
return -EFAULT;
......@@ -1647,7 +1647,7 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx,
} else {
return -ENOSPC;
return -ESRCH;
if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage)))
return -EFAULT;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment