linux/io_uring
Jens Axboe adeaa3f290 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: fd37b884003c ("io_uring/io-wq: don't clear PF_IO_WORKER on exit")
Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-06-14 12:54:55 -06:00
..
2023-04-26 12:40:31 -07:00
2023-04-26 12:40:31 -07:00
2022-12-07 06:47:13 -07:00
2022-07-24 18:39:11 -06:00
2023-05-04 08:19:05 -06:00
2023-01-29 15:17:41 -07:00
2023-04-03 07:16:15 -06:00
2022-07-24 18:39:14 -06:00
2023-05-07 10:00:09 -07:00
2023-04-26 12:52:58 -07:00