public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH -next] io_uring: use timespec64_valid() to verify time value
@ 2021-12-02  6:49 Ye Bin
  2021-12-09  2:15 ` yebin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ye Bin @ 2021-12-02  6:49 UTC (permalink / raw)
  To: axboe, asml.silence, io-uring, linux-kernel; +Cc: Ye Bin

It's better to use timespec64_valid() to verify time value.

Fixes: 2087009c74d4("io_uring: validate timespec for timeout removals")
Fixes: f6223ff79966("io_uring: Fix undefined-behaviour in io_issue_sqe")
Signed-off-by: Ye Bin <[email protected]>
---
 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 568729677e25..929ff732d6dc 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6151,7 +6151,7 @@ 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)
+		if (!timespec64_valid(&tr->ts))
 			return -EINVAL;
 	} else if (tr->flags) {
 		/* timeout removal doesn't support flags */
@@ -6238,7 +6238,7 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 	if (get_timespec64(&data->ts, u64_to_user_ptr(sqe->addr)))
 		return -EFAULT;
 
-	if (data->ts.tv_sec < 0 || data->ts.tv_nsec < 0)
+	if (!timespec64_valid(&data->ts))
 		return -EINVAL;
 
 	data->mode = io_translate_timeout_mode(flags);
-- 
2.31.1


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

* Re: [PATCH -next] io_uring: use timespec64_valid() to verify time value
  2021-12-02  6:49 [PATCH -next] io_uring: use timespec64_valid() to verify time value Ye Bin
@ 2021-12-09  2:15 ` yebin
  2021-12-16 13:15 ` yebin
  2021-12-16 15:07 ` Muchun Song
  2 siblings, 0 replies; 4+ messages in thread
From: yebin @ 2021-12-09  2:15 UTC (permalink / raw)
  To: axboe, asml.silence, io-uring, linux-kernel



On 2021/12/2 14:49, Ye Bin wrote:
> It's better to use timespec64_valid() to verify time value.
>
> Fixes: 2087009c74d4("io_uring: validate timespec for timeout removals")
> Fixes: f6223ff79966("io_uring: Fix undefined-behaviour in io_issue_sqe")
> Signed-off-by: Ye Bin <[email protected]>
> ---
>   fs/io_uring.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 568729677e25..929ff732d6dc 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -6151,7 +6151,7 @@ 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)
> +		if (!timespec64_valid(&tr->ts))
>   			return -EINVAL;
>   	} else if (tr->flags) {
>   		/* timeout removal doesn't support flags */
> @@ -6238,7 +6238,7 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
>   	if (get_timespec64(&data->ts, u64_to_user_ptr(sqe->addr)))
>   		return -EFAULT;
>   
> -	if (data->ts.tv_sec < 0 || data->ts.tv_nsec < 0)
> +	if (!timespec64_valid(&data->ts))
>   		return -EINVAL;
>   
>   	data->mode = io_translate_timeout_mode(flags);
ping...

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

* Re: [PATCH -next] io_uring: use timespec64_valid() to verify time value
  2021-12-02  6:49 [PATCH -next] io_uring: use timespec64_valid() to verify time value Ye Bin
  2021-12-09  2:15 ` yebin
@ 2021-12-16 13:15 ` yebin
  2021-12-16 15:07 ` Muchun Song
  2 siblings, 0 replies; 4+ messages in thread
From: yebin @ 2021-12-16 13:15 UTC (permalink / raw)
  To: axboe, asml.silence, io-uring, linux-kernel

ping...

On 2021/12/2 14:49, Ye Bin wrote:
> It's better to use timespec64_valid() to verify time value.
>
> Fixes: 2087009c74d4("io_uring: validate timespec for timeout removals")
> Fixes: f6223ff79966("io_uring: Fix undefined-behaviour in io_issue_sqe")
> Signed-off-by: Ye Bin <[email protected]>
> ---
>   fs/io_uring.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 568729677e25..929ff732d6dc 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -6151,7 +6151,7 @@ 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)
> +		if (!timespec64_valid(&tr->ts))
>   			return -EINVAL;
>   	} else if (tr->flags) {
>   		/* timeout removal doesn't support flags */
> @@ -6238,7 +6238,7 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
>   	if (get_timespec64(&data->ts, u64_to_user_ptr(sqe->addr)))
>   		return -EFAULT;
>   
> -	if (data->ts.tv_sec < 0 || data->ts.tv_nsec < 0)
> +	if (!timespec64_valid(&data->ts))
>   		return -EINVAL;
>   
>   	data->mode = io_translate_timeout_mode(flags);


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

* Re: [PATCH -next] io_uring: use timespec64_valid() to verify time value
  2021-12-02  6:49 [PATCH -next] io_uring: use timespec64_valid() to verify time value Ye Bin
  2021-12-09  2:15 ` yebin
  2021-12-16 13:15 ` yebin
@ 2021-12-16 15:07 ` Muchun Song
  2 siblings, 0 replies; 4+ messages in thread
From: Muchun Song @ 2021-12-16 15:07 UTC (permalink / raw)
  To: Ye Bin; +Cc: Jens Axboe, asml.silence, io-uring, LKML

On Thu, Dec 2, 2021 at 2:37 PM Ye Bin <[email protected]> wrote:
>
> It's better to use timespec64_valid() to verify time value.
>
> Fixes: 2087009c74d4("io_uring: validate timespec for timeout removals")
> Fixes: f6223ff79966("io_uring: Fix undefined-behaviour in io_issue_sqe")
> Signed-off-by: Ye Bin <[email protected]>

Reviewed-by: Muchun Song <[email protected]>

Thanks.

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

end of thread, other threads:[~2021-12-16 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-02  6:49 [PATCH -next] io_uring: use timespec64_valid() to verify time value Ye Bin
2021-12-09  2:15 ` yebin
2021-12-16 13:15 ` yebin
2021-12-16 15:07 ` Muchun Song

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