Skip to content

Commit

Permalink
io_uring: fix logic error in io_timeout
Browse files Browse the repository at this point in the history
If ctx->cached_sq_head < nxt_sq_head, we should add UINT_MAX to tmp, not
tmp_nxt.

Fixes: 5da0fb1 ("io_uring: consider the overflow of sequence for timeout req")
Signed-off-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
yangerkun authored and Jens Axboe committed Oct 17, 2019
1 parent 491381c commit 8b07a65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe)
* once there is some timeout req still be valid.
*/
if (ctx->cached_sq_head < nxt_sq_head)
tmp_nxt += UINT_MAX;
tmp += UINT_MAX;

if (tmp >= tmp_nxt)
break;
Expand Down

0 comments on commit 8b07a65

Please sign in to comment.