Skip to content

Commit 6f10ae8

Browse files
isilenceaxboe
authored andcommitted
io_uring/net: don't update msg_name if not provided
io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't provide it, we should retain NULL in this case. Cc: [email protected] Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 46a525e commit 6f10ae8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

io_uring/net.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ static int io_setup_async_msg(struct io_kiocb *req,
164164
}
165165
req->flags |= REQ_F_NEED_CLEANUP;
166166
memcpy(async_msg, kmsg, sizeof(*kmsg));
167-
async_msg->msg.msg_name = &async_msg->addr;
167+
if (async_msg->msg.msg_name)
168+
async_msg->msg.msg_name = &async_msg->addr;
168169
/* if were using fast_iov, set it to the new one */
169170
if (!kmsg->free_iov) {
170171
size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov;

0 commit comments

Comments
 (0)