* [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl
@ 2026-02-16 10:27 Asbjørn Sloth Tønnesen
2026-02-16 14:30 ` Gabriel Krisman Bertazi
2026-02-16 15:29 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-02-16 10:27 UTC (permalink / raw)
To: Jens Axboe
Cc: Asbjørn Sloth Tønnesen, Breno Leitao,
Gabriel Krisman Bertazi, io-uring, linux-kernel, stable
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.
Cc: stable@vger.kernel.org
Fixes: a5d2f99aff6b ("io_uring/cmd: Introduce SOCKET_URING_OP_GETSOCKOPT")
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
io_uring/cmd_net.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/io_uring/cmd_net.c b/io_uring/cmd_net.c
index cb2775936fb8..57ddaf874611 100644
--- a/io_uring/cmd_net.c
+++ b/io_uring/cmd_net.c
@@ -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
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl
2026-02-16 10:27 [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl Asbjørn Sloth Tønnesen
@ 2026-02-16 14:30 ` Gabriel Krisman Bertazi
2026-02-16 15:29 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-02-16 14:30 UTC (permalink / raw)
To: Asbjørn Sloth Tønnesen
Cc: Jens Axboe, Breno Leitao, io-uring, linux-kernel, stable
Asbjørn Sloth Tønnesen <ast@fiberby.net> writes:
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: a5d2f99aff6b ("io_uring/cmd: Introduce SOCKET_URING_OP_GETSOCKOPT")
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl
2026-02-16 10:27 [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl Asbjørn Sloth Tønnesen
2026-02-16 14:30 ` Gabriel Krisman Bertazi
@ 2026-02-16 15:29 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2026-02-16 15:29 UTC (permalink / raw)
To: Asbjørn Sloth Tønnesen
Cc: Breno Leitao, Gabriel Krisman Bertazi, io-uring, linux-kernel,
stable
On Mon, 16 Feb 2026 10:27:18 +0000, Asbjørn Sloth Tønnesen wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] io_uring/cmd_net: fix too strict requirement on ioctl
commit: 600b665b903733bd60334e86031b157cc823ee55
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-16 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 10:27 [PATCH] io_uring/cmd_net: fix too strict requirement on ioctl Asbjørn Sloth Tønnesen
2026-02-16 14:30 ` Gabriel Krisman Bertazi
2026-02-16 15:29 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox