Skip to contentSkip to conversation

io_uring: fix logic error in io_timeout

PATCH Applied yangerkun 2 participants 2 messages Oct 17, 2019

Subsystems (2)
lore
Share & tools
lore

yangerkun

author
#0 lore raw

PATCH 1/1 io_uring: fix logic error in io_timeout

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")
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index d2cb277da2f4..8781ab37b170 100644
@@ -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;
Signature · 1 line
2.17.2
maintainer Applied
#1 lore raw
Quoted 2 lines · yangerkun

If ctx->cached_sq_head < nxt_sq_head, we should add UINT_MAX to tmp, not tmp_nxt.

Applied, thanks.

Signature · 1 line
Jens Axboe