mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
io_uring: don't take files/mm for a dead task
[ Upstream commit 621fadc223 ]
In rare cases a task may be exiting while io_ring_exit_work() trying to
cancel/wait its requests. It's ok for __io_sq_thread_acquire_mm()
because of SQPOLL check, but is not for __io_sq_thread_acquire_files().
Play safe and fail for both of them.
Cc: stable@vger.kernel.org # 5.5+
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
85958f60eb
commit
a3647cddfe
@@ -1009,6 +1009,8 @@ static int __io_sq_thread_acquire_mm(struct io_ring_ctx *ctx)
|
||||
{
|
||||
struct mm_struct *mm;
|
||||
|
||||
if (current->flags & PF_EXITING)
|
||||
return -EFAULT;
|
||||
if (current->mm)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user