diff mbox series

io_uring: fix logic error in io_timeout

Message ID 20191017041235.45594-1-yangerkun@huawei.com (mailing list archive)
State New, archived
Headers show
Series io_uring: fix logic error in io_timeout | expand

Commit Message

Yang Erkun Oct. 17, 2019, 4:12 a.m. UTC
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>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Oct. 17, 2019, 5:27 p.m. UTC | #1
On 10/16/19 10:12 PM, yangerkun wrote:
> If ctx->cached_sq_head < nxt_sq_head, we should add UINT_MAX to tmp, not
> tmp_nxt.

Applied, thanks.
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index d2cb277da2f4..8781ab37b170 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1934,7 +1934,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;