summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@suse.de>2024-06-18 22:06:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 08:59:11 +0200
commit7703ee4c86c922e2b69d3b0d42ded1c4401529ab (patch)
tree7dc13620d0e0d118df7f2389b8d0fa60bb6aca0d /io_uring
parent47149c165a6faa253e21683e10b4d3fa56e5992c (diff)
downloadlinux-7703ee4c86c922e2b69d3b0d42ded1c4401529ab.tar.gz
linux-7703ee4c86c922e2b69d3b0d42ded1c4401529ab.tar.bz2
linux-7703ee4c86c922e2b69d3b0d42ded1c4401529ab.zip
io_uring: Fix probe of disabled operations
[ Upstream commit 3e05b222382ec67dce7358d50b6006e91d028d8b ] io_probe checks io_issue_def->not_supported, but we never really set that field, as we mark non-supported functions through a specific ->prep handler. This means we end up returning IO_URING_OP_SUPPORTED, even for disabled operations. Fix it by just checking the prep handler itself. Fixes: 66f4af93da57 ("io_uring: add support for probing opcodes") Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de> Link: https://lore.kernel.org/r/20240619020620.5301-2-krisman@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/opdef.c8
-rw-r--r--io_uring/opdef.h4
-rw-r--r--io_uring/register.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/io_uring/opdef.c b/io_uring/opdef.c
index 2e3b7b16effb..760006ccc408 100644
--- a/io_uring/opdef.c
+++ b/io_uring/opdef.c
@@ -725,6 +725,14 @@ const char *io_uring_get_opcode(u8 opcode)
return "INVALID";
}
+bool io_uring_op_supported(u8 opcode)
+{
+ if (opcode < IORING_OP_LAST &&
+ io_issue_defs[opcode].prep != io_eopnotsupp_prep)
+ return true;
+ return false;
+}
+
void __init io_uring_optable_init(void)
{
int i;
diff --git a/io_uring/opdef.h b/io_uring/opdef.h
index 7ee6f5aa90aa..14456436ff74 100644
--- a/io_uring/opdef.h
+++ b/io_uring/opdef.h
@@ -17,8 +17,6 @@ struct io_issue_def {
unsigned poll_exclusive : 1;
/* op supports buffer selection */
unsigned buffer_select : 1;
- /* opcode is not supported by this kernel */
- unsigned not_supported : 1;
/* skip auditing */
unsigned audit_skip : 1;
/* supports ioprio */
@@ -47,5 +45,7 @@ struct io_cold_def {
extern const struct io_issue_def io_issue_defs[];
extern const struct io_cold_def io_cold_defs[];
+bool io_uring_op_supported(u8 opcode);
+
void io_uring_optable_init(void);
#endif
diff --git a/io_uring/register.c b/io_uring/register.c
index c0010a66a6f2..11517b34cfc8 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -113,7 +113,7 @@ static __cold int io_probe(struct io_ring_ctx *ctx, void __user *arg,
for (i = 0; i < nr_args; i++) {
p->ops[i].op = i;
- if (!io_issue_defs[i].not_supported)
+ if (io_uring_op_supported(i))
p->ops[i].flags = IO_URING_OP_SUPPORTED;
}
p->ops_len = i;