Skip to contentSkip to conversation

io_uring/net: fix non-zc send with address

PATCH Applied Pavel Begunkov 2 participants 2 messages Sep 29, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring/net: fix non-zc send with address

We're currently ignoring the dest address with non-zerocopy send because even though we copy it from the userspace shortly after ->msg_name gets zeroed. Move msghdr init earlier.

Fixes 516e82f0e043a ("io_uring/net: support non-zerocopy sendto")
---
 io_uring/net.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
io_uring/net.c +6 -6
index 6b69eff6887e..4f671e6c8f3e 100644
@@ -333,6 +333,12 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
 	int min_ret = 0;
 	int ret;
 
+	msg.msg_name = NULL;
+	msg.msg_control = NULL;
+	msg.msg_controllen = 0;
+	msg.msg_namelen = 0;
+	msg.msg_ubuf = NULL;
+
 	if (sr->addr) {
 		if (req_has_async_data(req)) {
 			struct io_async_msghdr *io = req->async_data;
@@ -359,12 +365,6 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
 	if (unlikely(ret))
 		return ret;
 
-	msg.msg_name = NULL;
-	msg.msg_control = NULL;
-	msg.msg_controllen = 0;
-	msg.msg_namelen = 0;
-	msg.msg_ubuf = NULL;
-
 	flags = sr->msg_flags;
 	if (issue_flags & IO_URING_F_NONBLOCK)
 		flags |= MSG_DONTWAIT;
Signature · 1 line
2.37.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Pavel Begunkov

We're currently ignoring the dest address with non-zerocopy send because even though we copy it from the userspace shortly after ->msg_name gets zeroed. Move msghdr init earlier.

Applied, thanks!

[1/1] io_uring/net: fix non-zc send with address

      commit: 04360d3e05e885621a5860f987c6a8a2eac4bb27

Best regards,

Signature · 1 line
Jens Axboe