io_uring: hold uring_lock when walking link chain in io_wq_free_work()
authorJens Axboe <axboe@kernel.dk>
Mon, 11 May 2026 16:58:38 +0000 (10:58 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 May 2026 17:14:29 +0000 (11:14 -0600)
commit20c39819a27646573dfa0ac0d01c38895298a6f6
tree0daddd653a814874e9d40e2d54bebbbec445672d
parent3799c2570982577551023ae035f5a786cf39a76e
io_uring: hold uring_lock when walking link chain in io_wq_free_work()

io_wq_free_work() calls io_req_find_next() from io-wq worker context,
which reads and clears req->link without holding any lock. This can
potentially race with other paths that mutate the same chain under
ctx->uring_lock.

Take ctx->uring_lock around the io_req_find_next() call. Only requests
with IO_REQ_LINK_FLAGS reach this path, which is not the hot path.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c