[PATCH 3/3] io_uring: Don't read userspace data in io_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't need to read the userspace buffer, and the kernel side is
expected to write over it anyway.  Perhaps this was meant to allow
expansion of the interface for future parameters?  If we ever need to do
it, perhaps it should be done as a new io_uring opcode.

Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxx>
---
 io_uring/register.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/io_uring/register.c b/io_uring/register.c
index 8409fc80c1cb..a60eba22141a 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -37,7 +37,7 @@ static __cold int io_probe(struct io_ring_ctx *ctx, void __user *arg,
 {
 	struct io_uring_probe *p;
 	size_t size;
-	int i, ret;
+	int i, ret = 0;
 
 	if (nr_args > IORING_OP_LAST)
 		nr_args = IORING_OP_LAST;
@@ -47,13 +47,6 @@ static __cold int io_probe(struct io_ring_ctx *ctx, void __user *arg,
 	if (!p)
 		return -ENOMEM;
 
-	ret = -EFAULT;
-	if (copy_from_user(p, arg, size))
-		goto out;
-	ret = -EINVAL;
-	if (memchr_inv(p, 0, size))
-		goto out;
-
 	p->last_op = IORING_OP_LAST - 1;
 
 	for (i = 0; i < nr_args; i++) {
@@ -63,10 +56,8 @@ static __cold int io_probe(struct io_ring_ctx *ctx, void __user *arg,
 	}
 	p->ops_len = i;
 
-	ret = 0;
 	if (copy_to_user(arg, p, size))
 		ret = -EFAULT;
-out:
 	kfree(p);
 	return ret;
 }
-- 
2.45.2





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux