public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
@ 2025-01-23  0:32 Jens Axboe
  2025-01-23 14:53 ` Jann Horn
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2025-01-23  0:32 UTC (permalink / raw)
  To: io-uring; +Cc: Jann Horn

io_uring_cmd_sock() does a read of cmd->sqe->cmd_op, which may look
like it's the userspace shared SQE, but it's a copy at this point.
Use cmd->cmd_op rather than dip into the allocated SQE copy - it's
both simpler and faster and leaves less room for confusion.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index fc94c465a985..3993c9339ac7 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -350,7 +350,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)
 	if (!prot || !prot->ioctl)
 		return -EOPNOTSUPP;
 
-	switch (cmd->sqe->cmd_op) {
+	switch (cmd->cmd_op) {
 	case SOCKET_URING_OP_SIOCINQ:
 		ret = prot->ioctl(sk, SIOCINQ, &arg);
 		if (ret)
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-23 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23  0:32 [PATCH] io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock() Jens Axboe
2025-01-23 14:53 ` Jann Horn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox