From: Gabriel Krisman Bertazi <[email protected]>
To: [email protected]
Cc: [email protected], Gabriel Krisman Bertazi <[email protected]>
Subject: [PATCH 3/3] io_uring: Don't read userspace data in io_probe
Date: Tue, 18 Jun 2024 22:06:20 -0400 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
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 <[email protected]>
---
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
next prev parent reply other threads:[~2024-06-19 2:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 2:06 [PATCH 0/3] io_uring op probing fixes Gabriel Krisman Bertazi
2024-06-19 2:06 ` [PATCH 1/3] io_uring: Fix probe of disabled operations Gabriel Krisman Bertazi
2024-06-19 2:06 ` [PATCH 2/3] io_uring: Allocate only necessary memory in io_probe Gabriel Krisman Bertazi
2024-06-19 2:06 ` Gabriel Krisman Bertazi [this message]
2024-06-19 13:44 ` [PATCH 3/3] io_uring: Don't read userspace data " Jens Axboe
2024-06-19 14:55 ` Gabriel Krisman Bertazi
2024-06-19 14:57 ` Jens Axboe
2024-06-19 13:42 ` [PATCH 0/3] io_uring op probing fixes Jens Axboe
2024-06-19 14:58 ` (subset) " Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox