diff options
author | Breno Leitao <leitao@debian.org> | 2023-10-16 15:47:46 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-10-20 00:42:03 +0200 |
commit | d2cac3ec823798861f8f39b4aa0ec960ffa997b0 (patch) | |
tree | 098ada23897a90ba2436af3f4c05c190e3ab6ba5 /io_uring/uring_cmd.c | |
parent | selftests/net: Extract uring helpers to be reusable (diff) | |
download | linux-d2cac3ec823798861f8f39b4aa0ec960ffa997b0.tar.xz linux-d2cac3ec823798861f8f39b4aa0ec960ffa997b0.zip |
io_uring/cmd: return -EOPNOTSUPP if net is disabled
Protect io_uring_cmd_sock() to be called if CONFIG_NET is not set. If
network is not enabled, but io_uring is, then we want to return
-EOPNOTSUPP for any possible socket operation.
This is helpful because io_uring_cmd_sock() can now call functions that
only exits if CONFIG_NET is enabled without having #ifdef CONFIG_NET
inside the function itself.
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://lore.kernel.org/r/20231016134750.1381153-9-leitao@debian.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/uring_cmd.c')
-rw-r--r-- | io_uring/uring_cmd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index 4bedd633c08c..42694c07d8fd 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -214,6 +214,7 @@ int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, } EXPORT_SYMBOL_GPL(io_uring_cmd_import_fixed); +#if defined(CONFIG_NET) int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) { struct socket *sock = cmd->file->private_data; @@ -240,3 +241,4 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) } } EXPORT_SYMBOL_GPL(io_uring_cmd_sock); +#endif |