io_uring: drop mm/files between task_work_submit

[ Upstream commit aec18a57edad562d620f7d19016de1fc0cc2208c ]

Since SQPOLL task can be shared and so task_work entries can be a mix of
them, we need to drop mm and files before trying to issue next request.

Cc: stable@vger.kernel.org # 5.10+
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Pavel Begunkov 2021-02-09 04:47:50 +00:00 committed by Greg Kroah-Hartman
parent 88dbd085a5
commit 5592eae784

View File

@ -2084,6 +2084,9 @@ static void __io_req_task_submit(struct io_kiocb *req)
else else
__io_req_task_cancel(req, -EFAULT); __io_req_task_cancel(req, -EFAULT);
mutex_unlock(&ctx->uring_lock); mutex_unlock(&ctx->uring_lock);
if (ctx->flags & IORING_SETUP_SQPOLL)
io_sq_thread_drop_mm();
} }
static void io_req_task_submit(struct callback_head *cb) static void io_req_task_submit(struct callback_head *cb)