Skip to content

Commit

Permalink
io_uring: set msg_name on msg fixup
Browse files Browse the repository at this point in the history
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: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Feb 5, 2021
1 parent 5280f7e commit 2a78080
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -4558,6 +4558,7 @@ static int io_setup_async_msg(struct io_kiocb *req,
async_msg = req->async_data;
req->flags |= REQ_F_NEED_CLEANUP;
memcpy(async_msg, kmsg, sizeof(*kmsg));
async_msg->msg.msg_name = &async_msg->addr;
return -EAGAIN;
}

Expand Down Expand Up @@ -4610,7 +4611,6 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock,

if (req->async_data) {
kmsg = req->async_data;
kmsg->msg.msg_name = &kmsg->addr;
/* if iov is set, it's allocated already */
if (!kmsg->iov)
kmsg->iov = kmsg->fast_iov;
Expand Down Expand Up @@ -4839,7 +4839,6 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock,

if (req->async_data) {
kmsg = req->async_data;
kmsg->msg.msg_name = &kmsg->addr;
/* if iov is set, it's allocated already */
if (!kmsg->iov)
kmsg->iov = kmsg->fast_iov;
Expand Down

0 comments on commit 2a78080

Please sign in to comment.