io_uring: fix race between timeout flush and removal io_uring-cur
authorJens Axboe <axboe@kernel.dk>
Fri, 8 Apr 2022 17:08:58 +0000 (11:08 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 8 Apr 2022 17:21:59 +0000 (11:21 -0600)
commitdc53f70a29c2ff6c8242bd1cd9a07e09eb8782db
tree34db599e6c287496b64bae6a35b63bf2a85fba27
parent4cdd158be9d09223737df83136a1fb65269d809a
io_uring: fix race between timeout flush and removal

io_flush_timeouts() assumes the timeout isn't in progress of triggering
or being removed/canceled, so it unconditionally removes it from the
timeout list and attempts to cancel it.

Leave it on the list and let the normal timeout cancelation take care
of it.

While we're in there, fix two nonsensical cq_timeouts manipulations
which stem from when we didn't use an atomic_t for them. Setting them
to the read value + 1 can be done much cleaner with just an atomic_inc.

Cc: stable@vger.kernel.org # 5.5+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c