lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 2 Dec 2021 14:49:46 +0800
From:   Ye Bin <yebin10@...wei.com>
To:     <axboe@...nel.dk>, <asml.silence@...il.com>,
        <io-uring@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     Ye Bin <yebin10@...wei.com>
Subject: [PATCH -next] io_uring: use timespec64_valid() to verify time value

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 <yebin10@...wei.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ