Skip to content

Commit df447a3

Browse files
btw616jmberg-intel
authored andcommitted
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: 5cde609 ("um: generalize os_rcv_fd") Signed-off-by: Tiwei Bie <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 7ebf70c commit df447a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/um/os-Linux/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ ssize_t os_rcv_fd_msg(int fd, int *fds, unsigned int n_fds,
535535
cmsg->cmsg_type != SCM_RIGHTS)
536536
return n;
537537

538-
memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len);
538+
memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0));
539539
return n;
540540
}
541541

0 commit comments

Comments
 (0)