Skip to contentSkip to conversation

io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep

PATCH Applied Ye Bin 2 participants 2 messages Nov 29, 2021

Subsystems (2)
lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH 1/1 io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep

This patch fix another scene lead to the issue which "io_uring: Fix undefined-behaviour in io_issue_sqe" commit descript. Add check if timeout is legal which user space pass in when call io_timeout_remove_prep to update timeout value.

---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)
fs/io_uring.c +2 -0
index 39fd7372b324..de913334f22e 100644
@@ -6114,6 +6114,8 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
 			return -EINVAL;
 		if (get_timespec64(&tr->ts, u64_to_user_ptr(sqe->addr2)))
 			return -EFAULT;
+		if (tr->ts.tv_sec < 0 || tr->ts.tv_nsec < 0)
+			return -EINVAL;
 	} else if (tr->flags) {
 		/* timeout removal doesn't support flags */
 		return -EINVAL;
Signature · 1 line
2.31.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Ye Bin

This patch fix another scene lead to the issue which "io_uring: Fix undefined-behaviour in io_issue_sqe" commit descript. Add check if timeout is legal which user space pass in when call io_timeout_remove_prep to update timeout value.

Applied, thanks!

[1/1] io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep

      commit: 2087009c74d41ab8579f08157bca55b7d0857ee5

Best regards,

Signature · 1 line
Jens Axboe