[SRU focal/linux-oem-5.6 1/1] io_uring: fix missing msg_name assignment

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Fri May 14 12:14:38 UTC 2021

From: Pavel Begunkov <asml.silence at gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1928028

Ensure to set msg.msg_name for the async portion of send/recvmsg,
as the header copy will copy to/from it.

Cc: stable at vger.kernel.org # v5.5+
Signed-off-by: Pavel Begunkov <asml.silence at gmail.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(backported from commit dd821e0c95a64b5923a0c57f07d3f7563553e756)
[cascardo: missing commit 52de1fe12240, there is no io_recvmsg_copy_hdr]
[cascardo: also, recvmsg paths do not set msg_name when copying msg,
 but use uaddr]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 8276c3c42894..387d779ab26b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3034,6 +3034,7 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 	if (req->flags & REQ_F_NEED_CLEANUP)
 		return 0;
+	io->msg.msg.msg_name = &io->msg.addr;
 	io->msg.iov = io->msg.fast_iov;
 	ret = sendmsg_copy_msghdr(&io->msg.msg, sr->msg, sr->msg_flags,

More information about the kernel-team mailing list