public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH -next] io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep
@ 2021-11-29  4:15 Ye Bin
  2021-11-29 13:48 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ye Bin @ 2021-11-29  4:15 UTC (permalink / raw)
  To: axboe, asml.silence, io-uring, linux-kernel; +Cc: 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.

Signed-off-by: Ye Bin <[email protected]>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 39fd7372b324..de913334f22e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep
  2021-11-29  4:15 [PATCH -next] io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep Ye Bin
@ 2021-11-29 13:48 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-11-29 13:48 UTC (permalink / raw)
  To: asml.silence, linux-kernel, io-uring, Ye Bin

On Mon, 29 Nov 2021 12:15:37 +0800, Ye Bin wrote:
> 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,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-29 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29  4:15 [PATCH -next] io_uring: Fix undefined-behaviour in io_issue_sqe if pass large timeout value when call io_timeout_remove_prep Ye Bin
2021-11-29 13:48 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox