]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
io_uring: fix complete_post races for linked req
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 9 Mar 2021 00:37:59 +0000 (00:37 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Mar 2021 14:28:42 +0000 (07:28 -0700)
commit7a612350a989866510dc5c874fd8ffe1f37555d2
tree4a43e1283d75dfbf6c9fea031c3962007b8071b9
parent33cc89a9fc248a486857381584cc6b67d9405fab
io_uring: fix complete_post races for linked req

Calling io_queue_next() after spin_unlock in io_req_complete_post()
races with the other side extracting and reusing this request. Hand
coded parts of io_req_find_next() considering that io_disarm_next()
and io_req_task_queue() have (and safe) to be called with
completion_lock held.

It already does io_commit_cqring() and io_cqring_ev_posted(), so just
reuse it for post io_disarm_next().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5672a62f3150ee7c55849f40c0037655c4f2840f.1615250156.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c