Re: [PATCH] mm: use down_read_killable for locking mmap_sem in access_remote_vm

From: Oleg Nesterov
Date: Wed May 15 2019 - 10:30:22 EST


> @@ -4348,7 +4348,9 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
> void *old_buf = buf;
> int write = gup_flags & FOLL_WRITE;
>
> - down_read(&mm->mmap_sem);
> + if (down_read_killable(&mm->mmap_sem))
> + return 0;
> +

I too think that "return 0" looks a bit strange even if correct, to me
"return -EINTR" would look better.

But I won't insist, this is cosmetic.

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>