summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-01-26 11:17:00 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-30 13:55:18 +0100
commit7bf3fb6243a3b153ab1854b331ec19d67a4878bb (patch)
treece9a17ae020ca7353102dfb33d3a2ce46678e34d /kernel
parent08a922a6fdf8c3eaea7f6a3beb13c6eed75994dc (diff)
kernel/io_uring: cancel io_uring before task works
[ Upstream commit b1b6b5a30dce872f500dc43f067cba8e7f86fc7d ] For cancelling io_uring requests it needs either to be able to run currently enqueued task_works or having it shut down by that moment. Otherwise io_uring_cancel_files() may be waiting for requests that won't ever complete. Go with the first way and do cancellations before setting PF_EXITING and so before putting the task_work infrastructure into a transition state where task_work_run() would better not be called. 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 1f236ed375f8..d13d67fc5f4e 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -63,6 +63,7 @@
#include <linux/random.h>
#include <linux/rcuwait.h>
#include <linux/compat.h>
+#include <linux/io_uring.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
@@ -762,6 +763,7 @@ void __noreturn do_exit(long code)
schedule();
}
+ io_uring_files_cancel(tsk->files);
exit_signals(tsk); /* sets PF_EXITING */
/* sync mm's RSS info before statistics gathering */