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>] [day] [month] [year] [list]
Message-ID: <20250910090347.2950-1-zhangjiao2@cmss.chinamobile.com>
Date: Wed, 10 Sep 2025 17:03:47 +0800
From: zhangjiao2 <zhangjiao2@...s.chinamobile.com>
To: axboe@...nel.dk
Cc: io-uring@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	zhang jiao <zhangjiao2@...s.chinamobile.com>
Subject: [PATCH] io_uring/mock: Modify the return value check

From: zhang jiao <zhangjiao2@...s.chinamobile.com>

The return value of copy_from_iter and copy_to_iter can't be negative,
check whether the copied lengths are equal.

Signed-off-by: zhang jiao <zhangjiao2@...s.chinamobile.com>
---
 io_uring/mock_file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_uring/mock_file.c b/io_uring/mock_file.c
index 45d3735b2708..bdbb1bd8e2c8 100644
--- a/io_uring/mock_file.c
+++ b/io_uring/mock_file.c
@@ -42,7 +42,7 @@ static int io_copy_regbuf(struct iov_iter *reg_iter, void __user *ubuf)
 
 		if (iov_iter_rw(reg_iter) == ITER_SOURCE) {
 			ret = copy_from_iter(tmp_buf, len, reg_iter);
-			if (ret <= 0)
+			if (ret != len)
 				break;
 			if (copy_to_user(ubuf, tmp_buf, ret))
 				break;
@@ -50,7 +50,7 @@ static int io_copy_regbuf(struct iov_iter *reg_iter, void __user *ubuf)
 			if (copy_from_user(tmp_buf, ubuf, len))
 				break;
 			ret = copy_to_iter(tmp_buf, len, reg_iter);
-			if (ret <= 0)
+			if (ret != len)
 				break;
 		}
 		ubuf += ret;
-- 
2.33.0




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ