Commit 2a780802 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: set msg_name on msg fixup

io_setup_async_msg() should fully prepare io_async_msghdr, let it also
handle assigning msg_name and don't hand code it in [send,recv]msg().
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5280f7e5
...@@ -4558,6 +4558,7 @@ static int io_setup_async_msg(struct io_kiocb *req, ...@@ -4558,6 +4558,7 @@ static int io_setup_async_msg(struct io_kiocb *req,
async_msg = req->async_data; async_msg = req->async_data;
req->flags |= REQ_F_NEED_CLEANUP; req->flags |= REQ_F_NEED_CLEANUP;
memcpy(async_msg, kmsg, sizeof(*kmsg)); memcpy(async_msg, kmsg, sizeof(*kmsg));
async_msg->msg.msg_name = &async_msg->addr;
return -EAGAIN; return -EAGAIN;
} }
...@@ -4610,7 +4611,6 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, ...@@ -4610,7 +4611,6 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock,
if (req->async_data) { if (req->async_data) {
kmsg = req->async_data; kmsg = req->async_data;
kmsg->msg.msg_name = &kmsg->addr;
/* if iov is set, it's allocated already */ /* if iov is set, it's allocated already */
if (!kmsg->iov) if (!kmsg->iov)
kmsg->iov = kmsg->fast_iov; kmsg->iov = kmsg->fast_iov;
...@@ -4839,7 +4839,6 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, ...@@ -4839,7 +4839,6 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock,
if (req->async_data) { if (req->async_data) {
kmsg = req->async_data; kmsg = req->async_data;
kmsg->msg.msg_name = &kmsg->addr;
/* if iov is set, it's allocated already */ /* if iov is set, it's allocated already */
if (!kmsg->iov) if (!kmsg->iov)
kmsg->iov = kmsg->fast_iov; kmsg->iov = kmsg->fast_iov;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment