Skip to content
Commit adeaa3f2 authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring/io-wq: clear current->worker_private on exit

A recent fix stopped clearing PF_IO_WORKER from current->flags on exit,
which meant that we can now call inc/dec running on the worker after it
has been removed if it ends up scheduling in/out as part of exit.

If this happens after an RCU grace period has passed, then the struct
pointed to by current->worker_private may have been freed, and we can
now be accessing memory that is freed.

Ensure this doesn't happen by clearing the task worker_private field.
Both io_wq_worker_running() and io_wq_worker_sleeping() check this
field before going any further, and we don't need any accounting etc
done after this worker has exited.

Fixes: fd37b884

 ("io_uring/io-wq: don't clear PF_IO_WORKER on exit")
Reported-by: default avatarZorro Lang <zlang@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cac9e441
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment