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:16:42 +0200
commit4c2c59cc838c999b62c0bca2b90817e561ac5f79 (patch)
treeb319efc27233140fc054696b5d522b892b91c086
parentc2ff91255e0157b356cff115d8dc3eeb5162edf2 (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 617886d1fb1e..21f0e50fb1df 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -535,7 +535,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;
}