summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiwei Bie <tiwei.btw@antgroup.com>2025-09-01 08:27:15 +0800
committerJohannes Berg <johannes.berg@intel.com>2025-09-10 14:24:19 +0200
commitdf447a3b4a4b961c9979b4b3ffb74317394b9b40 (patch)
treef54e649eed2414eba5746e35323d2a00b4d9d8fd
parent7ebf70cf181651fe3f2e44e95e7e5073d594c9c0 (diff)
um: Fix FD copy size in os_rcv_fd_msg()
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>
-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;
}