Date: Mon, 21 Aug 2023 11:41:20 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 74614fa93a62 - stable/13 - linux(4): Fix MSG_CTRUNC handling in recvmsg() Message-ID: <202308211141.37LBfKdo045913@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=74614fa93a62385b899b34e9f44a098a6ddc3cb4 commit 74614fa93a62385b899b34e9f44a098a6ddc3cb4 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-08-14 12:46:12 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-08-21 10:39:05 +0000 linux(4): Fix MSG_CTRUNC handling in recvmsg() The MSG_CTRUNC flag of the msg_flags member of the message header is set uppon successful completition if the control data was truncated. Upon return from a successful call msg_controllen should contain the length of the control message sequence. Fixes: 0eda2cea MFC after: 1 week (cherry picked from commit 2467ccddc0e0f5c719eddaece69a7aa0589b6449) --- sys/compat/linux/linux_socket.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index ba17e38c1c64..421247570701 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1830,8 +1830,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, if (error != 0) goto bad; + skiped = outlen = 0; maxlen = l_msghdr.msg_controllen; - l_msghdr.msg_controllen = 0; if (control == NULL) goto out; @@ -1839,7 +1839,6 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, msg->msg_control = mtod(control, struct cmsghdr *); msg->msg_controllen = control->m_len; outbuf = PTRIN(l_msghdr.msg_control); - skiped = outlen = 0; for (m = control; m != NULL; m = m->m_next) { cm = mtod(m, struct cmsghdr *); lcm->cmsg_type = bsd_to_linux_cmsg_type(p, cm->cmsg_type, @@ -1905,9 +1904,9 @@ err: error = EINVAL; goto bad; } - l_msghdr.msg_controllen = outlen; out: + l_msghdr.msg_controllen = outlen; error = copyout(&l_msghdr, msghdr, sizeof(l_msghdr)); bad:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308211141.37LBfKdo045913>