io_uring/cmd_net: fix too strict requirement on ioctl
Subsystems (2)
PATCH 1/1 io_uring/cmd_net: fix too strict requirement on ioctl
Attempting SOCKET_URING_OP_SETSOCKOPT on an AF_NETLINK socket resulted in an -EOPNOTSUPP, as AF_NETLINK doesn't have an ioctl in its struct proto, but only in struct proto_ops.
Prior to the blamed commit, io_uring_cmd_sock() only had two cmd_op operations, both requiring ioctl, thus the check was warranted.
Since then, 4 new cmd_op operations have been added, none of which depend on ioctl. This patch moves the ioctl check, so it only applies to the original operations.
AFAICT, the ioctl requirement was unintentional, and it wasn't visible in the blamed patch within 3 lines of context.
--- io_uring/cmd_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
io_uring/cmd_net.c +6 -3
@@ -160,16 +160,19 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)struct proto *prot =READ_ONCE (sk->sk_prot);int ret, arg =0 ; -if (!prot || !prot->ioctl) -return -EOPNOTSUPP ; -switch (cmd->cmd_op) {case SOCKET_URING_OP_SIOCINQ : +if (!prot || !prot->ioctl) +return -EOPNOTSUPP ; + ret = prot->ioctl (sk,SIOCINQ , &arg);if (ret)return ret;return arg;case SOCKET_URING_OP_SIOCOUTQ : +if (!prot || !prot->ioctl) +return -EOPNOTSUPP ; + ret = prot->ioctl (sk,SIOCOUTQ , &arg);if (ret)return ret;
base-commit: bb7a3fc2c976b5d0deb35a54ca237519816d7ba9
Signature · 1 line
2.51.0
Quoted 11 lines · Asbjørn Sloth Tønnesen
Attempting
SOCKET_URING_OP_SETSOCKOPTon anAF_NETLINKsocket resulted in an-EOPNOTSUPP, asAF_NETLINKdoesn't have an ioctl in its struct proto, but only in structproto_ops.Prior to the blamed commit,
io_uring_cmd_sock()only had twocmd_opoperations, both requiring ioctl, thus the check was warranted.Since then, 4 new
cmd_opoperations have been added, none of which depend on ioctl. This patch moves the ioctl check, so it only applies to the original operations.
Quoted 6 lines
AFAICT, the ioctl requirement was unintentional, and it wasn't visible in the blamed patch within 3 lines of context.
Fixes a5d2f99aff6b ("io_uring/cmd: Introduce SOCKET_URING_OP_GETSOCKOPT")Signed-off-by Asbjørn Sloth Tønnesen <[email protected]>
Signature · 1 line
Gabriel Krisman Bertazi
Quoted 8 lines · Asbjørn Sloth Tønnesen
Attempting
SOCKET_URING_OP_SETSOCKOPTon anAF_NETLINKsocket resulted in an-EOPNOTSUPP, asAF_NETLINKdoesn't have an ioctl in its struct proto, but only in structproto_ops.Prior to the blamed commit,
io_uring_cmd_sock()only had twocmd_opoperations, both requiring ioctl, thus the check was warranted.[...]
Applied, thanks!
[1/1] io_uring/cmd_net: fix too strict requirement on ioctl
commit: 600b665b903733bd60334e86031b157cc823ee55
Best regards,
Signature · 1 line
Jens Axboe