]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
io_uring/net: don't update msg_name if not provided
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 29 Sep 2022 21:23:18 +0000 (22:23 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 Nov 2022 13:23:51 +0000 (14:23 +0100)
BugLink: https://bugs.launchpad.net/bugs/1996825
commit 6f10ae8a155446248055c7ddd480ef40139af788 upstream.

io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't
provide it, we should retain NULL in this case.

Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/io_uring.c

index 4e7eb7fca40780721db155a904d5887c86af3c23..f5feaeaa1f5c28fb981c23ce8680e68038876d22 100644 (file)
@@ -4762,7 +4762,8 @@ 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;
+       if (async_msg->msg.msg_name)
+               async_msg->msg.msg_name = &async_msg->addr;
        /* if were using fast_iov, set it to the new one */
        if (!async_msg->free_iov)
                async_msg->msg.msg_iter.iov = async_msg->fast_iov;