Skip to content

Commit 04360d3

Browse files
isilenceaxboe
authored andcommitted
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: 516e82f ("io_uring/net: support non-zerocopy sendto") Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/176ced5e8568aa5d300ca899b7f05b303ebc49fd.1664409532.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 6ae91ac commit 04360d3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

io_uring/net.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
333333
int min_ret = 0;
334334
int ret;
335335

336+
msg.msg_name = NULL;
337+
msg.msg_control = NULL;
338+
msg.msg_controllen = 0;
339+
msg.msg_namelen = 0;
340+
msg.msg_ubuf = NULL;
341+
336342
if (sr->addr) {
337343
if (req_has_async_data(req)) {
338344
struct io_async_msghdr *io = req->async_data;
@@ -359,12 +365,6 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
359365
if (unlikely(ret))
360366
return ret;
361367

362-
msg.msg_name = NULL;
363-
msg.msg_control = NULL;
364-
msg.msg_controllen = 0;
365-
msg.msg_namelen = 0;
366-
msg.msg_ubuf = NULL;
367-
368368
flags = sr->msg_flags;
369369
if (issue_flags & IO_URING_F_NONBLOCK)
370370
flags |= MSG_DONTWAIT;

0 commit comments

Comments
 (0)