diff --git a/net/core/scm.c b/net/core/scm.c index 100ba6d..38a0b77 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -230,11 +230,12 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) i++, cmfptr++) { int new_fd; + int flags = INDIRECT_PARAM(file_flags, flags) & O_CLOEXEC; err = security_file_receive(fp[i]); if (err) break; err = get_unused_fd_flags(MSG_CMSG_CLOEXEC & msg->msg_flags - ? O_CLOEXEC : 0); + ? O_CLOEXEC : flags); if (err < 0) break; new_fd = err;