io_uring: fix logic error in io_timeout
authoryangerkun <yangerkun@huawei.com>
Thu, 17 Oct 2019 04:12:35 +0000 (12:12 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Oct 2019 21:49:15 +0000 (15:49 -0600)
If ctx->cached_sq_head < nxt_sq_head, we should add UINT_MAX to tmp, not
tmp_nxt.

Fixes: 5da0fb1ab34c ("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>
fs/io_uring.c

index b7d4085d6ffd0979deda5043ba64a41e29cbd3c9..1d03afd743685dedf938dc938dee7ad10f2a0134 100644 (file)
@@ -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;