summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiwei Bie <tiwei.btw@antgroup.com>2025-09-01 08:27:15 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-25 11:13:42 +0200
commit3112c70b2e01f7a934c7664c5f34e4e5745f2458 (patch)
tree38bbdd28dfa27673bd5c85c2c109c086b5ee8b20
parent00e98b5a69034b251bb36dc6e7123d7648e218e4 (diff)
um: Fix FD copy size in os_rcv_fd_msg()
[ Upstream commit df447a3b4a4b961c9979b4b3ffb74317394b9b40 ] When copying FDs, the copy size should not include the control message header (cmsghdr). Fix it. Fixes: 5cde6096a4dd ("um: generalize os_rcv_fd") Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--arch/um/os-Linux/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index f1d03cf3957f..62c176a2c1ac 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -556,7 +556,7 @@ ssize_t os_rcv_fd_msg(int fd, int *fds, unsigned int n_fds,
cmsg->cmsg_type != SCM_RIGHTS)
return n;
- memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len);
+ memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0));
return n;
}