Skip to content

Commit 88b1958

Browse files
isilencegregkh
authored andcommitted
io_uring: annotate offset timeout races
commit 5498bf2 upstream. It's racy to read ->cached_cq_tail without taking proper measures (usually grabbing ->completion_lock) as timeout requests with CQE offsets do, however they have never had a good semantics for from when they start counting. Annotate racy reads with data_race(). Reported-by: [email protected] Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/4de3685e185832a92a572df2be2c735d2e21a83d.1684506056.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a78a8bc commit 88b1958

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/timeout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ int io_timeout(struct io_kiocb *req, unsigned int issue_flags)
545545
goto add;
546546
}
547547

548-
tail = ctx->cached_cq_tail - atomic_read(&ctx->cq_timeouts);
548+
tail = data_race(ctx->cached_cq_tail) - atomic_read(&ctx->cq_timeouts);
549549
timeout->target_seq = tail + off;
550550

551551
/* Update the last seq here in case io_flush_timeouts() hasn't.

0 commit comments

Comments
 (0)