@@ -229,11 +229,14 @@ static inline int io_uring_cmd_setsockopt(struct socket *sock,
if (err)
goto fail;
- err = -EOPNOTSUPP;
- if (level == SOL_SOCKET && !sock_use_custom_sol_socket(sock)) {
+ if (level == SOL_SOCKET && !sock_use_custom_sol_socket(sock))
err = sock_setsockopt(sock, level, optname,
KERNEL_SOCKPTR(koptval), optlen);
- }
+ else if (unlikely(!sock->ops->setsockopt))
+ err = -EOPNOTSUPP;
+ else
+ err = sock->ops->setsockopt(sock, level, optname,
+ KERNEL_SOCKPTR(koptval), optlen);
fail:
kfree(koptval);
Add generic support for SOCKET_URING_OP_SETSOCKOPT, expanding the current case, that just execute if level is SOL_SOCKET. This implementation basically calls sock->ops->setsockopt() with a kernel allocated optval; Since the callback for ops->setsockopt() is already using sockptr_t, then the callbacks are leveraged to be called directly, similarly to __sys_setsockopt(). Signed-off-by: Breno Leitao <leitao@debian.org> --- io_uring/uring_cmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)