aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-04-25 01:26:03 +0200
committerJens Axboe <axboe@kernel.dk>2021-04-25 10:29:03 -0600
commitff244303301f6f2ac90107c61d18826efd0af822 (patch)
tree0c11fe34c2e36512b56c43ba13170856ffc56485 /kernel/fork.c
parentio_uring: update sq_thread_idle after ctx deleted (diff)
downloadlinux-dev-ff244303301f6f2ac90107c61d18826efd0af822.tar.xz
linux-dev-ff244303301f6f2ac90107c61d18826efd0af822.zip
kernel: always initialize task->pf_io_worker to NULL
Otherwise io_wq_worker_{running,sleeping}() may dereference an invalid pointer (in future). Currently all users of create_io_thread() are fine and get task->pf_io_worker = NULL implicitly from the wq_manager, which got it either from the userspace thread of the sq_thread, which explicitly reset it to NULL. I think it's safer to always reset it in order to avoid future problems. Fixes: 3bfe6106693b ("io-wq: fork worker threads from original task") cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index b81ccb1ca3a7..224c8317df34 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -927,6 +927,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
tsk->splice_pipe = NULL;
tsk->task_frag.page = NULL;
tsk->wake_q.next = NULL;
+ tsk->pf_io_worker = NULL;
account_kernel_stack(tsk, 1);