]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:56:40 +0000 (09:56 +0200)
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>
io_uring/io_uring.c

index 0e9ac7df6ad708193230f41cab07e186f4f9e7cd..e53ece718bf8a17dedfef1525d81a024e48287dd 100644 (file)
@@ -5850,7 +5850,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 (!kmsg->free_iov) {
                size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov;